How to Find PHP Path Location

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.

  1. Create a text file with only the text below, then save it as info.php.
    • phpinfo();
  2. Upload the info.php file to the root directory of your website folder.
  3. Open a web browser, then visit the info.php page.
  4. 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.
PHP Info Screen
A typical PHP Info Screen. This one shows the Environment section

Leave a comment

Your email address will not be published. Required fields are marked *