php included file not updating after edit - php

I am using Pear Mail to send an email via php. I first ran into trouble when all the includes didn't work in the Pear Mail library - but found the answer when research showed I needed to change all the file paths to absolute file paths. I am doing that... BUT, after changing one and refreshing my browser window, the error message did not change:
the line in question:
include_once "Net/SMTP.php";
and this is the warning I get:
Warning: include_once(Net/SMTP.php): failed to open stream: No such file or directory in /usr/local/lib/php/Mail/smtp.php on line 348
I changed "Net/SMTP.php" to be: "/home/username/php/Net/SMTP.php" in the file path, and I continue to receive that same error. In a previous change (where I messed up) I got the error and saw the new incorrect file path in the Warning, so I know that part of the message should be at least changing.
I checked many things to make sure I'm not crazy:
that my edits went through - I opened the file I edited in 2 separate editors and saw my changes were correct.
that my file path was correct - again, checked both separate editors to make sure the file path was correct.
searched for a duplicate file name in another folder - in case I was editing the wrong file.
And I did the following to try to fix it:
changed the file path to something different
changed all "include_once" to "include" (in case my browser didn't want to reload a file
refreshed the heck out of my browser/cleared the cache/viewed on several browsers and computers
Googled everything I could think of
looked in a real-life paper book for possible newbie mistakes
My intuition tells me my browser isn't refreshing the included files.
But perhaps it's my server that isn't?
My intuition also tells me this is a basic mistake you would learn to avoid on day one.
Any help, clues, leading questions, links, etc... are greatly appreciated.
Thank you!!!

You should use this in the command line window:
pear install Mail
pear install Net_SMTP
Then your paths are not required any more since PHP takes care of it.
If you do not have installed pear before you of course have to do it first.
https://pear.php.net/manual/en/installation.php

Related

PHP website Warning: require(/../core/database/connect.php): failed to open stream

Hi I want to put my website(web application in PHP) on a server of my school and it’s for a project for school. So I had read the instructions of my school where I had to put my source code. I had to put in a folder called ‘Html’ and according to my school that is used for php hosting. After putting my files in that folder I went to browse to my website.
But it doesn’t show me the website when I browse to it. Instead it had given me a error message, see link below:
http://i.imgur.com/dfYxc02.jpg
After reading the error message I thought it had something to do with this line of code in connect.php file:
mysql_connect('145.92.203.240', 'user', mypassword');
I thought that was looking fine, but I also tried “mysql_connect('localhost, 'user', mypassword');”, but I still receive the same error message.
Furthermore I had tried in “/etc/init.d” to restart apache. For this I used the following command:
apache2 –k restart
But I couldn’t restart apache because I don’t have permission.
I also had tried in “/var/www/localhost/htdocs” to show index.html on the browser. But that didn’t work as wel. I also couldn’t remove te index.html file and replace it with my source code.
Could someone please tell me the solution in steps?
Okay here we go:
You're trying to include a file and the location is wrong
For instance, require('config.php'); will assume the file is in the same folder as the script. require('./folder/config.php'); will assume the file is in the folder. So you may want to check exactly where connect.php is.
The error about include_path
It seems as if you have a var include_path defined somewhere, might want to check that out. If you migrated it, you need to change the var to the new location.

New server - Unable to create wordpress pages - Blank /wp-admin/post.php

Recently I moved a website to a new server. The website was working perfectly on the shared server, but I've encountered a host of permission issues and other problems since relocating to EC2. I have changed the ownership of the /var/www/html folder to apache to allow altering altering of settings on the back end of WordPress. Strangely enough, I am able to create new posts, but when I attempt to update an existing page or create a new one, I receive a blank page. [http://example.com/wp-admin/post/php] Originally I thought it was yet another permission based issue, but after researching that doesn't appear to be the case.
Steps I've taken thus far:
1) Changed ownership of the directory to apache
2) Disabled all my plugins
3) Added : php_flag output_buffering on to .htaccess (Although I wasn't sure if it mattered where in the .htaccess file I should put that command)
From the research I've done it appears that white space after the ?> could be the cause. Anyone know how I could tell which file would have this white space? Several of my files actually do not even have the PHP close tag. One additional note, my previous server was version 5.2.17 to 5.3.20. Any other ideas?
After checking the error logs I discovered that I was missing the mbstring PHP library, which has a function that was called by one of my theme files. Once added I was able to create and alter pages on the backend of WordPress without issue.
To all the folks who get this kind of error of page not displaying must check option.
turn on error reporting if you have commented the lines in your wp-config.php
#ini_set('display_errors','Off');
and than check for error.
if it has the error like this
PHP Warning: Cannot modify header information - headers already sent by (output started at /[server info]/wp-config.php:77)
than check your wp-config.php for extra space at top and bottom of the page.remove extra line spaces even. and than re-upload the wp-config.php.
Most of time this will solve your problem.
Happy Coding!!!!
I had a similar problem and by removing extra spaces before the "< ?php" fixed the issue. Although apparently it was a different theme functions file that was causing the issue. Make sure you look at the php file referenced in the php warning. In this example, it's 'wp-config', but it could be really anything.
PHP Warning: Cannot modify header information - headers already sent by (output started at /[server info]/wp-config.php:77)
Good luck!
Basically this issue happens because you have edited the file directly on cpanel editor or other simple text editor. Just create a new .php file and paste your post.php code in that file. Now save this file and replace this new one with old post.php.

Installing JPGraph with Hostgator website

I've been trying to install jpgraph to my hostgator website but there's a problem somewhere which I can't figure out. There's a few things which are causing me to think the problem could be in several places;
first, when unpacking the file to my desktop ready to put into the server I get an error of 'The destination folder is a subfolder of the source folder', for this I just click continue and it seems to be OK.
This unpacks the folders which I rename to jpgraph as per the example FAQ on http://jpgraph.net/download/manuals/chunkhtml/ch02.html#id2475509
second, when I look at the examples the original code is [code]require_once ('jpgraph/jpgraph.php'); though the file structure is such that it should be jpgraph/src/jpgraph.php though even when I update the file structre the file doesn't work.
Third, I noticed when looking at different files some of the file structures reference jpgraph 3.xxx(version)/jpgraph.php but others use the short form jpgraph/jpgraph.php
I can't find any reasonable installation (see:Any) installation tutorials from youtube and the other thread on SO wasn't very helpful as it was solved in the background.
From your comment it looks like your php script just cannot find the jpgraph scripts, p.e. wrong path.
Try something like this, if you're using jpgraph as the graph lib of your choice:
$jpgraph_dir = '/your/path/to/your/jpgraph/';
require_once($jpgraph_dir . 'src/jpgraph.php');
If you still receive this error message, your path is just wrong.

Weird PHP error on server

All of a sudden, my SMF powered forum has stopped working.
In fact, PHP files no longer seem to want to open on my website. I tried uploading a blank PHP file with just a few characters of text, and it refuses to open giving the error below.
I also tried a PHPinfo file, which didnt work, giving the same error. Other sites on the same server are working.
Fatal error: Unknown: Failed opening required '/home/users/a/n/mysite/www/index1.php' (include_path='.') in Unknown on line 0
Any ideas about whats gone wrong?
Just an idea. As it happens to all php files that could to what i know only mean 2 things.
Either there is somekind of error on the php extension.
OR what it most likely is, is that SMF uses a .htaccess to make user friendly links. Which means all requests to the server no matter what (Unless specified in the .htaccess) will be sent to index.php and then be handled.
So if there is a error in the index.php or the library of some sort it would explain why no matter what php file you're looking at it gives the error.
-
One thing you could do is to take a backup of all your images in the system. Then try to install a fresh version on your local machine. Once done copy/past the images back and copy all the current php files for SMF and replace the current ones on your host with them.
-
Haven't used SMF much so I'm not sure this is the solution at all. But to me it sounds like a solution.
It seems you have broken your root document.
do chmod 755 index1.php
and it should solve the problem.
You should check the php.ini or php5.ini file. I don't believe the single ticks around '.' for the include_path are valid. Double quotes will work however.
It seems you have been hacked:
http://wordpress.org/support/topic/fatal-error-unknown-failed-opening-required-google_verifyphp
Ahh sorry reread the question. I guess this is what you may try.
Check your file permissions. by default if your web server can not read files thats what you are going to get. I could be wrong but worth having a look
so just chmod your root folder to say 755 atleast

Flex Builder 4, ZendAMF and Data Services - Error?

I'm trying to set up my Flex Builder 4 dev environment, up to and including PHP and the ZendFramework on a WAMP stack on my hard drive.
Everything goes swimmingly until I try to set up a data service. I point it to the php class file, it populates the various fields in the form so I know it understood it, and I press next. After a little bit of tweaking I have the ZendFramework installed and everything seems to be pointing the right way, so I'm not sure why I'm getting this error:
"Make sure that Zend Framework is installed correctly and the parameter "amf.production" is not set to true in the amf_config.ini file located in the project output folder.
Warning: include_once(C:\wamp\www\TestDrive-debug\EmployeeService.php) [function.include-once]: failed to open stream: Permission denied in C:\wamp\ZendFramework\library\Zend\Loader.php on line 146"
What could be causing a permissions error like that? It's not on the system level because I went into properties and fully opened that file up so even a basic user has full permissions - still no dice.
I'm not reeeally a PHP guy so this is a bit beyond my skillset. Has anyone encountered this problem before? I'm just following the tutorial I have here and it SHOULD work. I'm just not clear on what would be causing a permissions issue like this.
Thanks!
I resolved this problem by changing the encoding of the php file. There must be some invisible characters in the file that were screwing up the parsing. Try saving the php service file with different encoding and see if it works for you. The one that worked for me was created by eclipse. I copy pasted the code in it, saved, and boom it worked!
just had same issue and resolved same as OP, just resave file with notepad, funny deal, but it happens
inside the folder of amf_Config.ini , create a new file amf_config2.ini , copy the contents of amf_config.ini as it is into amf_config2.ini , now inside amf_config2 double quote the value of parameter webroot (webroot="xxxxx") save ur amf_config2 , open gateway.php which would be also inside the same dir , change $configfile = "$dir/amf_config.ini" to
$configfile = "$dir/amf_config2.ini" , save it and try

Categories