running PHP from Command Line Shell

If you want to test some PHP code without using the browser interface, you can create a script to use command line shell as follows. Let us call this script scripting.php. Under Linux, create this file with the php extension and specify the executable path:

#!/usr/bin/php -q
echo 'Hello';

Change the mode to executable:

chmod 755 scripting.php

and run it :

./scripting.php

It should work if your PHP is already well configured.

Please follow and like us:
This entry was posted in Computer Science and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published.