Page 1 of 1

Run PHP scripts standalone

Posted: Sun Jan 12, 2003 2:52 am
by Jacobus
Is there an interpreter to do that? I have a case in which I have to run a script in a certain time interval (once every three hours), which is being done using cron. I could (of course) code in perl, but I was just wondering if there's some standalone interpreter around.

Posted: Sun Jan 12, 2003 3:09 am
by volka
you might be interested in http://www.php.net/manual/en/features.commandline.php
Maybe you already have /usr/bin/php
If not and if you're not willing to recompile the whole package without any webserver-support (which should by default create /usr/bin/php) you might use lynx -dump http://url.of/script to invoke your script via cron

Posted: Sun Jan 12, 2003 3:18 am
by Jacobus
Ah, thank you. So it will only be possible on systems running the latest version of PHP. Unfortunately the host is running a board system written in PHP (WWWThreads), and as the variable passing has been changed with version 4.2, I fear the whole board system will stop to work, as well as a lot of pages written by different people. Perl it will be then. :?

Posted: Sun Jan 12, 2003 3:20 am
by Jacobus
And, it has to stay on that server, because it has some file handling to do, parsing the contents of files, and putting it to a local database.

Posted: Sun Jan 12, 2003 3:23 am
by volka
you still can switch back to the old mechanism by enabling register_globals = On in your php.ini
You might also install a second version of php for testing purposes changing the base path when calling ./configure for the source package.
./configure --help will provide more details.

Posted: Sun Jan 12, 2003 3:24 am
by Jacobus
Ok, I'll look into it. Thanks again.

Posted: Sun Jan 12, 2003 3:32 am
by volka
you really should consider an update since some (serious security) fixes took place since then ;)

http://www.php.net/ChangeLog-4.php and then search for fixed

Posted: Sun Jan 12, 2003 10:30 am
by Jacobus
Though you're probably right: it's not my machine...

Posted: Sun Jan 12, 2003 6:15 pm
by volka
then you're probably stucked with lynx -dump. But calling a script via http://localhost/script.php that is restricted to localhost by <LIMIT ...> in .htaccess should be sufficient ;)