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

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Add your voice!