Run a PHP File from the Command Line



Apache/2.4.18 (Ubuntu) Server at Port 80
" data-via="andrewsirianni">Tweet

Sometimes you may need to run a PHP file from the command line - this may be the case if you're running your PHP file as a cron job.

Here is a quick and easy way to run your PHP file from the command line.

php -q /path/to/your/file.php

Not that in some instances, you may need to specify the path to your PHP installation rather than simply typing "php". For example:

/path/to/php /path/to/your/file.php

comments powered by Disqus

About Me

I design & develop software that runs on the Internet. As a qualified analyst, accountant and real estate agent, I can deploy systems that improve performance.


Warning: DOMDocument::load( failed to open stream: HTTP request failed! HTTP/1.0 410 Gone in /home/andrxvjf/public_etc/templates/rmargin/twitter.tpl.php on line 8

Warning: DOMDocument::load(): I/O warning : failed to load external entity "" in /home/andrxvjf/public_etc/templates/rmargin/twitter.tpl.php on line 8

Recent Tweets

Follow me: @andrewsirianni

Copyright ©2012 Andrew Sirianni, All Rights Reserved   LinkedIn Profile