PHP Cannot find a file that exists

Avatar
  • Answered
I have a contact form that uses PHP, including PEAR modules. This has worked fine for quite a few years. When I try to update from PHP 5.2 to 5.3 or 5.4 I get the following errors when the contact form code is run:

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

Warning: include_once(): Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/lib/php/Mail/smtp.php on line 348

Fatal error: Class 'Net_SMTP' not found in /usr/local/lib/php/Mail/smtp.php on line 349

The SMTP.php file DOES exist in NET directory.

Here is line 348 in smpt.php:
include_once '/home/therap16/php/Net/SMTP.php';

I simply cannot find out how to solve this issue and have to revert back to PHP 5.2 to make this code work again, which it does immediately.

I cannot find any clues by google searches, or on php.net, but for other reasons need to upgrade to PHP 5.3 minimum. I have tried with or without php.ini files in my root, but nothing has made a difference Can anyone help please?
Avatar
Scott
Hello,

First I apologize for the plethora of test comments you received during my testing of your site. I did find out the answer, however. With the site running off of php 5.2, it does not use the php.ini file on your account, but the server one. With that, all the paths, etc are correct.

If you switch to 5.3, it also uses the server php.ini file so the include paths it uses to find things are the same as the one with 5.2. However, if you notice, the path it is using to find the Net/smtp.php is '/usr/local/lib/php/Mail/'. The server is correct that "Net/smtp.php" does not exist in that path. It does, however, exist in your local path. The local path is not in the includes list as you are running off of the server version of the php.ini file.

What you needed was a php.ini file that includes your local path. Once that was included, the version was set back to 5.3 and it now works properly.

Kindest Regards,
Scott M