[OSM-dev] [OTish] php on the command line

Nick Hill nick at nickhill.co.uk
Sun Oct 8 14:30:08 BST 2006


Hello James and Nick

James' solution is assuming the use of Windows. PHP does work well on the 
command line irrespective of which operating system you use.

In other words, PHP can be invoked as a binary directly by the system, without 
using an apache module.

If you are using Ubuntu, Debian or other Debian derivative, you probably want to do

sudo aptitude install php4-cli

This will create binaries called php and php4, which can be used to invoke scripts.

You may want to put the following at the top of the script to directly invoke 
the executable script:

#!/usr/bin/php4

Otherwise
php4 <scriptname>



James R Glasgow wrote:
> 
> Nick Whitelegg wrote:
>> Am attempting to develop the Freemap renderer into a flexible rendering 
>> system, capable of reading from the live API, a local .osm file or a local 
>> database, and writing either ImageMagick or GD png.
>>
>> Would also like it to be runnable from the command line. I'd prefer not to 
>> have to convert from PHP to some other language. Is anyone aware of any 
>> issues using PHP as a standalone, non web based, scripting language? Having 
>> to install it on Windows is the main one that springs to mind.
>>
>> Nick
>>   
> PHP works great from the command line.  I have used it before in this 
> manner. And Yes, the only problem is that you have to have it installed, 
> well not actually installed, you have  to have the windows binaries and 
> the libraries on the system, you would need a registry entry to allow 
> any file with the .php extension to run automatically, and the php.ini 
> file in the system32 directory. otherwise you can have all the binaries 
> and libraries in one folder for example "c:\php" without the registry 
> entry you just have to run for the program "c:\php\php.exe 
> path\script.php" to run the script.
> 
> James R Glasgow
>




More information about the dev mailing list