I’ve got a basic php script that runs perfect in a browser. I want to run this same php script at the shell command line (Freebsd 8.0), but I’m having troubles when the script tries to connect to the database using “mysql_query”….the rest of the script runs fine, but the connection to the database just doesn’t happen.
I verified that the php.ini in phpinfo() is what I am using, but still nothing.
Here’s the command:
php -c /usr/local/etc/php.ini /data/phpscript.php
The ouptput should be an array of data, which i verified the SQL with in phpmyadmin and results are there, instead it returns nothing and I don’t get any error messages in the log files.
Any ideas whats going on here? I’ve always used the browser to run my php stuff, but this time I need to put it into a crontab and run it from the server directly on a schedule.
Thanks in advance
echo the error code and error string the mysqli function can give you after each run.
Also check that your php.ini does not shut down your error messages (so you do not see anything as there is no Apache error log in CLI).
This two steps should give you the answer.