I have written several scripts that are to be run as cron jobs. The scripts run fine when called from a browser via http, but when the scripts are run from the shell it fails to connect to the mysql database. Error show below:
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/local/psa/home/vhosts/noosa.qld.gov.au/httpdocs/test.php on line 3
PHP is running as a module via HTTP and as CGI from the shell. Can anyone shed any light on what may be the cause here?