To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > Linux/Unix Help

Linux/Unix Help Help with server-side Linux and Unix issues

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-27-2002, 10:40 PM   #1
SasonX
Junior Member
 
Join Date: Aug 2002
Location: Australia
Posts: 3
Question PHP and cron jobs

Hi,

I wanted to set up a cron job to extract data from a MySQL database, formatting the results. My Linux system does have a /usr/bin/php and I tried /usr/bin/php < test.php (it simply had phpinfo() in it ) and that worked fine, but when I tried anything against the MySQL database it complained of not finding the mysql_pconnect function.

Does anybody know how I can do do this .. do I need to recompile PHP or something like that, or change my PATH etc .. or can I NOT use PHP for such tasks ( advise on other possibilities would be helpful if I cant do this in PHP)

Thanks in advance
SasonX is offline   Reply With Quote
Old 08-28-2002, 12:44 PM   #2
frigidman
Internet Programmer
 
frigidman's Avatar
 
Join Date: Nov 2001
Location: USA
Posts: 197
I had that problem at first on my Yellowdog linux box. The commandline version of the PHP it installed, didnt have --with-mysql set. You are most likely going to have to recompile PHP for commandline use and inclue the mysql libraries/headers.

To do this, find out the entire configure string for your web based PHP (use the phpinfo() function in a web page to find it at the top). Copy that, then edit out "--with-apxs" (if that is how it was configured, usually the case though, as the alternative would be something else) and ADD "--without-apache --enable-force-cgi-redirect".

Then recompile and install. It should NOT alter your php.in... should NOT alter you php for your webserver either... BUT, just to be on the safe side, I would suggest you make copies of those two files before you do this, just in case.

This is normally where those things are installed by default with redhat flavour os distributions (you may find yours in different places):

cp /etc/php.ini /etc/php.ini~
cp /usr/lib/apache/libphp4.so /usr/lib/apache/libphp4.so~

Anyhow, this is how I got my command line php installed to act exactly like my web version, so i had no guesswork to do with crontab php scripts (and shell php scripts). Hope this helps... if you are using mandrake, or some other OS... your milage may vary.
__________________
-Randall Shaw
The Web Choice (resellers welcome)
Wonderful web technology at your fingertips,
without the burden of knowing how to do it.
frigidman is offline   Reply With Quote
Old 09-03-2002, 05:50 AM   #3
deharsh
Junior Member
 
Join Date: Sep 2002
Posts: 4
i never get shell php working in my systems.
i use the following combinations to get the cron job done:
1) the crontab
2) the wget utility

just fetch wget http://127.0.0.1/what_ever.php will do

hope it helps.

deharsh
deharsh is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 01:18 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.