0

I am working out a problem with crontab where a php script that has no html in it to run as a stand alone script daily tends to fail using /usr/bin/php and works just fine as /usr/bin/php-cgi.

The Error under /usr/bin/php

PHP Warning:  include_once(Net/SMTP.php): failed to open stream: No such file or directory in /var/www/html/iop/lib/Mail/smtp.php on line 206
PHP Warning:  include_once(): Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php:./lib/:./lib/Net/:./lib/Mail/:./lib/Log/') in /var/www/html/iop/lib/Mail/smtp.php on line 206
PHP Fatal error:  Class 'Net_SMTP' not found in /var/www/html/iop/lib/Mail/smtp.php on line 210

the files have a 775 permission on them.

With putting in absolute path in, we still get the same error.

include('/var/www/html/iop/lib/Net/SMTP.php');

PHP Warning:  include_once(Net/SMTP.php): failed to open stream: No such file or directory in /var/www/html/iop/lib/Mail/smtp.php on line 206
PHP Warning:  include_once(): Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php:./lib/:./lib/Net/:./lib/Mail/:./lib/Log/') in /var/www/html/iop/lib/Mail/smtp.php on line 206
PHP Fatal error:  Class 'Net_SMTP' not found in /var/www/html/iop/lib/Mail/smtp.php on line 210

Just wondering if anybody else has ran into this issue / know whats up?

  • Are you sure this is the right line you're modifying? You show an include('...') but the error message is talking about include_once. – user2313067 Jul 31 '16 at 8:18
0

It may be that php and php-cgi resolve some paths differently.

Have you tried to include this with an absolute path? Does it work?

include_once('/usr/share/php/Net/SMTP.php');

depending on where you have it installed, of course.

| improve this answer | |
  • that doesn't work. – thebtm Jul 28 '16 at 18:59
  • Could you post the error message that results from trying to include the absolute path (above), please? – Asu Jul 29 '16 at 11:50
  • its the exact same error but with an absolute path. – thebtm Jul 29 '16 at 14:45
  • Can you show output for this bash command: " ls -la /usr/share/php/Net/ " (without quotes, for whatever the path is where you have the file) just to make sure file system permissions are not the problem – Asu Jul 30 '16 at 18:10
0

This was abandoned, but only to clarify those afterall these years:

The absolute path sould be changed on the file trying to include, in that case the file is /var/www/html/iop/lib/Mail/smtp.php in line 206.

| improve this answer | |
  • the tool being referenced was using php4 methods instead of using it as php5 or even php7 (going based on at the time). once this was corrected, everything started working again. i meant to share the answer but i don't remember the exact deals now as it was 3 years ago. – thebtm Mar 23 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.