cron not working when calling php script with mysql on linux box
Category: Computers > Operating Systems
Asked by: isound1-ga
List Price: $30.00
27 Aug 2006 11:43 PDT
Expires: 26 Sep 2006 11:43 PDT
Question ID: 759955
Some scripts on my crontab on redhat enterprise linux 4 aren't working. These are php scripts. I've tracked it down to a specific issue. If the script has a mysql database call in it it returns a connection error. Call to undefined function: mysql_pconnect() The scripts run fine from the root command line but can't connect when run via the cron. I've have read that there is something i can add to /etc/crontab to get this to work. Maybe an export command or a path. I have tried many things but its not working. thanks.
Re: cron not working when calling php script with mysql on linux box
Answered By: theta-ga on 27 Aug 2006 13:57 PDT
Hi isound1-ga, The fact that you can connect to mySql from the console indicates that your mySql has been setup correctly. Since the problem occurs only when you are running a cron job, it is most likely due to an incorrectly formatted or relative path. Note that all the paths in your cron script should be absolute. Also modify your script such that it uses absolute paths also. For eg., if you are running the script in your cron file with the following command: php mailman.php change it to something like: /usr/local/bin/php /var/www/html/mailman.php Similarily modify the script to use absolute paths, and see if that helps. If the above does not help, then please post your crontab file and the failing php scripts. Also look at the following resources for more help with troubleshooting your problem: - [SOLVED] CRON not PHP'ing [http://justlinux.com/forum/archive/index.php/t-143818.html] - [Typo3-debian] cronjob, mysql_pconnect [http://lists.netfielders.de/pipermail/typo3-debian/2004-October/001001.html] - Re: Call to undefined function: mysql_pconnect() [http://firstname.lastname@example.org/2005-06/msg04065.html] - Fatal error: Call to undefined function mysql_pconnect() [http://www.experts-exchange.com/Web/Web_Languages/PHP/PHP_Databases/Q_21709658.html] =========================================================== Hope this helps. if you need any clarifications, just ask! Regards, Theta-ga :) ============================================================= Google Search Terms Used: Call to undefined function: mysql_pconnect() cron
|There are no comments at this time.|
If you feel that you have found inappropriate content, please let us know by emailing us at email@example.com with the question ID listed above. Thank you.
|Search Google Answers for|