I recently wanted to create a cron job that ran a PHP script, but could not figure out how to find the valid location on my web server for PHP. Here is how I located it.
- Create a text file with only the text below, then save it as info.php.
- Upload the info.php file to the root directory of your website folder.
- Open a web browser, then visit the info.php page.
- The page will give you a bunch of information about PHP. Scroll down to the “Environment” section where it says “PATH“. This will provide you with location(s) for PHP. In my case, I have PHP in both the /bin and /usr/bin folders.