Web Hosting Talk







View Full Version : Configuring php for command line


bubblehost.com
08-11-2001, 02:13 PM
I keep getting errors when I try to call a php page from the crontab. How do i fix this?

Thanks!

Justin

texasweb
08-29-2001, 06:00 PM
What kind of errors?

bubblehost.com
08-29-2001, 06:05 PM
I think it is like file or folder not found.

Thanks

mikeknoxv
08-29-2001, 09:04 PM
Originally posted by bubblehost.com
I think it is like file or folder not found.

Thanks

An EXACT error would be extremely helpful.

bubblehost.com
08-29-2001, 09:08 PM
here it is:

--------------------------------------------------------------------------
From root Sat Aug 11 12:42:00 2001
Date: Sat, 11 Aug 2001 12:42:00 -0500
From: root (Cron Daemon)
To: root
Subject: Cron <root@www> /home/sites/home/auto/creatacct.php > /tmp/logdump.LOG
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>

/bin/sh: /home/sites/home/auto/creatacct.php: No such file or directory
---------------------------------------------------------------------------
Thanks

mikeknoxv
08-29-2001, 09:17 PM
Hmm... I'll leave this to the more technically superior ;)

Sure you've specified the correct path to your php file?

nexzt
08-29-2001, 10:14 PM
try chmod 755'ing it.

if that doesn't work then try going /some/path/./script.php also.

jks
08-30-2001, 11:47 AM
You would also get the "file not found"-error if the first line of the script is incorrect. Check if it has a hash-bang at the start, and that the path for the php interpreter is correct.

ljprevo
08-30-2001, 12:22 PM
This error is because you do not have php installed as a cgi or you installed it in a different directory than what the shubang at the top of the creatacct.php file is looking for. You have to install two versions of php on your site one works with Apache as a DSO and the other works as a Command line scripting language and can run at root.

You can run two different version of PHP on your Raq

I just install Autosetup and installed a second copy of PHP per his intrustions and it worked GREAT, and you can run a php from cron!

Here was his instructions, these are if you are using mqsql also:


Via telnet, login as su -

go to any directory /home/sites/home/ will work
Any directory of your choice that is.

type:
wget http://www.php.net/do_download.php?download_file=php-4.0.6.tar.gz&source_site=www.php.net
(this is all one line, it don't show that here because of word wrap)

This will download the latest tar file when it is done type:

gunzip php-4.0.6.tar.gz

then type:

tar xvf php-4.0.6.tar

cd to the directory it creates
in that directory type:

./configure --with-mysql

When that is done type:

make

When that is done type:
make install

nexzt
08-30-2001, 01:06 PM
by default php compiles the cgi version to /usr/local/bin/php