2010-02-15

Execute PHP in Linux

Simple way to execute a PHP in linux :

1. Find the Folder where your PHP resides , In my case its /usr/bin/php
2. Export the path to tell linux that your PHP resides here :
    export PATH=$PATH:/usr/bin
3. Now write #!/usr/bin/php on top of your PHP file that you want to execute.
4. Execute the php with :
    ./ path of you php file


More over you can easily execute linux command in that file using : exec();