[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


What's the default location of PHP

Posted on 2008-11-06
Medium Priority
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

Steve earned 880 total points
ID: 22899660
just type 'which php'

and that'll tell you where its installed..

LVL 14

Assisted Solution

cjl7 earned 880 total points
ID: 22899673
Or change the #! line to #!/usr/bin/env php -q

LVL 68

Assisted Solution

woolmilkporc earned 240 total points
ID: 22899923
.. 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.

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.


Author Comment

ID: 22900002
I tried both of your suggestions and get this response, an ideas? Thanks for your help.
Extension '/var/www/vhosts/domain.com/httpdocs/spot/admin/cron/cron_pop.php' 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')

Author Comment

ID: 22900054
Nevermind, in the cron job setup I entered this in the command line instead:
/usr/bin/php /var/www/vhosts/domain.com/httpdocs/spot/admin/cron/cron_pop.php
LVL 12

Expert Comment

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


Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month19 days, 16 hours left to enroll

873 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