Execute Perl/PHP scripts from the command line

Executing PHP/Perl scripts from the command line is a very easy task. Executing scripts from the command line can be very useful when troubleshooting cron jobs.

For PHP, just use the php command:

root@web [/backup]# php /home/manus/public_html/phpscript.php
I am a PHP script ... :)
root@web [/backup]#

For Perl, we will use the perl command:

root@web [/backup]# perl /home/manus/public_html/perlscript.pl
Hi
I'm a PERL script.
root@web [/backup]#

For specific command options run php -h and perl -h.

As you see, when using the commands without any options, the output will be printed on the terminal.