What's the default location of PHP

Posted on 2008-11-06
Last Modified: 2013-12-06
How do I find the default location of PHP on my Linux Server (Red Hat Fedora Core 7 - I think).
I need this for the special instructions on setting up a cron job:
In my case, /usr/local/bin is empty.

Ensure that the first line of the cron file is the location of php on the server.  
Default first line entry on this file is:
#!/usr/local/bin/php -q
The /usr/local/bin/php should be the location of php
Question by:pzozulka
    LVL 12

    Accepted Solution

    just type 'which php'

    and that'll tell you where its installed..

    LVL 14

    Assisted Solution

    Or change the #! line to #!/usr/bin/env php -q

    LVL 68

    Assisted Solution

    .. or check your rpm -
    issue 'rpm -qa | grep php ' to find your exact php package name, then
    issue 'rpm -qf [package name from above]' to see all the files the rpm package contains.

    Easily you will find your php binary and all the other interesting things in there.

    LVL 8

    Author Comment

    I tried both of your suggestions and get this response, an ideas? Thanks for your help.
    Extension '/var/www/vhosts/' not present.

    cron_pop.php is the script where I inserted
    1) #!/usr/bin/env php -q
    2) #!/usr/bin/php -q (<---------result of 'which php')
    LVL 8

    Author Comment

    Nevermind, in the cron job setup I entered this in the command line instead:
    /usr/bin/php /var/www/vhosts/
    LVL 12

    Expert Comment

    Yeah under cron you need to specify the entire path.. as youve done..


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now