Hi,

Tuesday, March 4, 2003, 2:58:50 PM, you wrote:
JMC> I have my PHP script running from cron now as root, but when I try to
JMC> run it as a non root user it doesn't work.  When I drop down to the non
JMC> root user and run the script by hand I get this.

JMC> /usr/libexec/ld-elf.so.1: Shared object "libmysqlclient.so.12" not found

JMC> any ideas why this wouldn't not happen as root but does as a non root
JMC> user?

JMC> thanks

JMC> Justin Michael Couto                [EMAIL PROTECTED]
JMC> Director of Operations              805.781.0420
JMC> Somnio World Web Solutions          http://www.somnioworld.com
 

JMC> -----Original Message-----
JMC> From: Tom Rogers [mailto:[EMAIL PROTECTED] 
JMC> Sent: Monday, March 03, 2003 6:23 PM
JMC> To: Justin Michael Couto
JMC> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
JMC> Subject: Re[2]: [PHP] Still no luck running a PHPCLI script from CRON

JMC> Hi,

JMC> Tuesday, March 4, 2003, 10:01:25 AM, you wrote:
JMC>> Dan,

JMC>> I used your example exactly like you have it specified.  My cron
JMC> log
JMC>> looks like this:

JMC>> Mar  3 15:53:00 prod /usr/sbin/cron[3085]: (root) CMD
JMC>> (/usr/local/contab-scripts/wibble.php)

JMC>> Mar  3 15:54:00 prod /usr/sbin/cron[3085]: (root) CMD
JMC>> (/usr/local/contab-scripts/wibble.php)

JMC>> However, it does nothing at all.  It doesn't create the
JMC>> /tmp/wibble.output file.  After testing this, I went in and ran the
JMC>> wibble.php script by hand from the command line and it worked just
JMC> as my
JMC>> scripts work when I run them by hand.  I ran the cron as root and
JMC> ran
JMC>> the script by hand as root.  I really think there is a bug
JMC> somewhere,
JMC>> either in FreeBSD or in PHP.  I am not sure what it can be.  All I
JMC> know
JMC>> is that other scripts like bash scripts run fine from cron.  This
JMC>> problem is really weird and I would truly appreciate any more
JMC> assistance
JMC>> in getting it resolved.

JMC>> Thanks everyone,


JMC>>
JMC> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

>>> Ok, by looking at my cron logs it looks like cron is trying to run my
>>> PHP CLI script.  However, it is not running it.  I only have one line
JMC>> of
>>> code that isn't commented out and the line simply sends me an email
>>> using the PHP mail() function.

JMC>> One thing to keep in mind when working with crontab is
JMC> environmental
JMC>> variables. As in, Cron has none. You have to set any you want in
JMC> your
JMC>> crontab, or your called scripts. For example, use full paths.

JMC>> You shouldnt have to call a shell before calling the php cli. Here
JMC> is an
JMC>> example script for you to test. My php binary is in
JMC> /usr/local/bin/php,
JMC>> my
JMC>> script is /usr/local/crontab-scripts/wibble.php and the file I am
JMC>> writing
JMC>> to is in /tmp/wibble.output

JMC>> This is what wibble looks like [chmoded to 755, owned by the user
JMC> of the
JMC>> crontab]:

JMC>> #!/usr/local/bin/php -q
JMC>> <?php
JMC>>   if ($fp = fopen("/tmp/wibble.output",a)) {
JMC>>     fputs($fp, "Script Executed on ".date("YmdHis")."\n");
JMC>>     fclose($fp);
JMC>>   } else {
JMC>>     die("Could not open 'wibble.output' for read / write
JMC> operations");
JMC>>   }
?>>>

JMC>> and the crontab line I have is:

JMC>> * * * * /usr/local/contab-scripts/wibble.php

JMC>> and you can see the output of it running every minute:

JMC>> tail -f /tmp/wibble.output

JMC>> Works fine for me ... try it

JMC>> -- 
JMC>> Dan Hardiker [EMAIL PROTECTED]
JMC>> ADAM Software & Systems Engineer
JMC>> First Creative



JMC>> -- 
JMC>> PHP General Mailing List (http://www.php.net/)
JMC>> To unsubscribe, visit: http://www.php.net/unsub.php

JMC> Try removing the -q's and see if root or whatever user cron runs as gets
JMC> an email with an error message in it, as cron is actully having a
JMC> crack at running the script.

JMC> -- 
JMC> regards,
JMC> Tom

Make sure /usr/local/mysql/lib is in the ld path (/etc/ld.so.conf)
or wherever the clientlib is located

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to