RE: [PHP] Running PHP from the shell or CRON???

From: Date: Mon, 28 Aug 2000 19:28:40 +0000
Subject: RE: [PHP] Running PHP from the shell or CRON???
Groups: php.general 
Request: Send a blank email to php-general+get-13989@lists.php.net to get a copy of this message
The error you are getting there is that php cannot find the script 'mytest.php'. (try typing php foo.php, you will get the same response). I don't know why it can't find the file, but it might be getting the virtual path messed up by being in the same directory as the PHP executable (the virtual path gets set to the path which the script is in, not the directory you are currently in). Why not add the cgi-bin to your path and run mytest.php in a seperate directory. The other way would be to explictly state PHP as the scripting language you are using in your script. ---------------------------------- Contents of mytest.php #!/usr/local/apache/cgi-bin/php -q <?php // PHP CODE GOES HERE... ?> ---------------------------------- Of course then you have to make the file executable (chmod 755 ...). It is definately possible to use PHP as scripting language. I know since it has replaced Perl as my scripting language of choice. (BTW the -q supresses the powered by and header output from PHP). -----Original Message----- From: Claude Cormier [mailto:techsupport@devises-or.com] Sent: August 28, 2000 7:41 AM To: PHP General List Subject: [PHP] Running PHP from the shell or CRON??? Hi, I am trying to run PHP from a shell via telnet. I am testing this because I eventually want to have a CRON job running this PHP script every day. The PHP script will simply check a site, parse the page and select some info to update a MySQL db. So I issue either one of the following shell command: %php mytest.php or %php ./mytest.php and received the following error: ~~~~~~~~~~~~~~~~~~~~~~~~~~ X-Powered-By: PHP/4.0.1.pl2 Content-type: text/html <br> <b>Fatal Error</b>: Unable to open mytest in <b>Unknown</b> on line <b>0</b><br> ~~~~~~~~~~~~~~~~~~~~~~~~~~~ I am runnuing this command for a cgi-bin where I have both PHP and mytest.php in it. cgi-bin is not in my path. So my question is can PHP be executed from the shell or from a CRON job, if yes what is the problem with the above? Thanks Claude C -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#13989) next »