What’s the full path to php in CentOS?

- by

The path to PHP is

/usr/bin/php

This is good to know if you need to setup a cron job which triggers a PHP file. Calling it from a web browser directly is not a problem, but if you have to call it from the command line or as a scheduled task you need to call it with

/usr/bin/php yourfile.php

You can also use wget or cURL but that’s often not reliable.

If your PHP file gives you an output (usually to the browser screen), your server will send you an email. If you;d rather this didn’t happen, direct it to nowhere like so:

/usr/bin/php yourfile.php > /dev/null 2>&1



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.