Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Jan 22, 2010 3:39 pm 
Offline
Newbie

Joined: Fri Jan 22, 2010 3:31 pm
Posts: 2
Website: http://dev.funkatronics.com
AOL: oliilo82
Location: New York, NY
I'm trying to run a PHP script from crond and I keep getting the following error:

Fatal error: Call to undefined function mysql_connect() in /path/to/script on line 45

I can run the script fine from a superuser bash prompt via ssh by literally copying and pasting the command from my crontab to the prompt and hitting enter, but if I set it to run through crond I always get this error. I thought the script might be running as a user that does not have permissions to access the mysql module, but I'm fairly certain the script is running as root as I have installed the cron entry in /etc/crontab as the root user (I'm running CentOS with php 5.2.x).

Any help would be greatly appreciated.


Top
   
 Post subject:
PostPosted: Fri Jan 22, 2010 10:56 pm 
Offline
Senior Member

Joined: Sat Jun 05, 2004 12:49 am
Posts: 333
Make sure the PHP it's running through cron is configured to load the mysql module. Use which to see what you're running when it works and use that path in your scripts shebang.


Top
   
 Post subject:
PostPosted: Sat Jan 23, 2010 3:42 pm 
Offline
Newbie

Joined: Fri Jan 22, 2010 3:31 pm
Posts: 2
Website: http://dev.funkatronics.com
AOL: oliilo82
Location: New York, NY
Wow you're right, apparently there's a slightly earlier version of the cli in my /usr/bin and my most recent version elsewhere. Specifying the full path to the php cli I actually want in my crontab did the trick. Was working on this for a looong time. You're the man!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group