Google Answers Logo
View Question
 
Q: cron not working when calling php script with mysql on linux box ( Answered,   0 Comments )
Question  
Subject: cron not working when calling php script with mysql on linux box
Category: Computers > Operating Systems
Asked by: isound1-ga
List Price: $30.00
Posted: 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.
Answer  
Subject: 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://www.archivum.info/fedora-list@redhat.com/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
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy