What’s the full path to php in CentOS?

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





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.