Any idea what could cause a php file to execute fine in the browser, but give an error when run in the command line interface?
So to be specific, when I visit mysite.com/script.php
in a browser, all is well.
When I execute php -f /var/www/mysite.com/public_html/script.php
I get an error that one of my required files cannot be found.
So, the error message gives a lot of insight, but I am confused because it works as intended in the browser with no error, so I have no idea what could cause this behavior. Any ideas?
By starting with ../
, which is relative to the current working directory of the process, the require
will only work if you are in the right directory. If you have control of the script, change it to use the full, absolute path starting at /
,
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments