If you are using xampp, you already have the php-cli library. In the terminal, type:
/opt/lampp/bin/php {input file} {arguments}
Done! If you don't like using /opt/lampp/bin/php every time, you can set php as an environment variable for /opt/lampp/bin/php.
To do this, go to terminal and type:
php=/opt/lampp/bin/php
export php
if you are using Bash Shell (the default one in Ubuntu), you can use this shortcut:
export php=/opt/lampp/bin/php
and reboot.
now you can use
php {input file} {arguments}
OK. Thanks for this useful information. Now testing some php codes from CLI. This process is most easy if we install 'tasksel' and then from the Terminal we input: sudo tasksel install lamp-server
ReplyDelete