How to query the PHP Installation Path (virtual host) in unix environment)

Source: Internet
Author: User
How to query the PHP Installation Path (virtual host) in the unix environment in the past few days, how to set cornjob
However, you need to know the php installation path when Setting this parameter.

It is generally said on the Internet that/usr/local/bin/php follows the absolute path of php, but it cannot be used after I try it.

I have tried several phpinfo addresses, but they cannot be used.

So how can I see the php installation path on the server.


Reply to discussion (solution)

Paste the content of your phpinfo Configure Command item.

Or locate phpize to see which Directory it is located. php's binfile should be in the same directory with it. If there is no information. Find/-name "phpize"

If the prefix is not specified during compilation, it will be installed under/usr/local/php/by default.

'. /Configure ''-- prefix =/usr/local/php5'' -- enable-force-cgi-redirect ''-- enable-fastcgi'' -- with-config-file-path = /usr/local/etc/php5/cgi ''-- with-curl =/usr/local/lib'' -- with-gd ''-- with-gettext'' --- jpeg-dir =/usr/local/lib ''-- with-freetype-dir =/usr/local/lib'' -- with-kerberos ''-- with-openssl ''-- with-mcrypt ''-- with-mhash'' -- with-mysql =/usr'' -- with-mysqli =/usr/bin/mysql_config ''-- with-pcre-regex = /usr/local ''-- with-pdo-mysql =/usr'' -- with-pear ''-- with-png-dir =/usr/local/lib'' -- -zlib ''-- with-zlib-dir =/usr/local/lib'' -- enable-zip ''-- enable-gd-native-ttf'' -- with-iconv = /usr/local'' -- enable-bcmath ''-- enable-calendar'' -- enable-ftp ''-- enable-magic-quotes'' -- enable-sockets ''-- enable -mbstring'


Phpinfo is like this.

I am a virtual host, so there is no way to execute server commands on it, only the DirectAdmin management panel

/Usr/local/php5
This is the installation directory. the binfile is/usr/local/etc/php5/bin/php. If you cannot access it, it may be a permission issue. The administrator of the VM should not let you touch this directory. otherwise, all the websites on the server will suffer if you change to a problem.

Php. ini is in the directory/usr/local/etc/php5/cgi.

I don't know if the setting is incorrect.

Set it

* ***/Usr/local/etc/php5/bin/php is followed by the absolute php path.

Is the statement that follows the execution every minute.
I set it to no response.

Each cornjob parameter is a * number, which should be once every minute ......

*/1 *****/usr/local/etc/php5/bin/php>/home/xx/cronlog

This is performed once every minute. If you want to check whether the execution is as you want. You can add a day to record, and then several minutes to see how many logs have been printed.

I ran this command and generated the cornlog file. However, after a long time, it was an empty file without any records. what is the situation ......

I used this php file to write data in a mysql database, and there was no result ......

Ls to check the path file under your php,

The simplest method is to detect processes.
Ps-ef | grep php
The paths listed below are basically.

Whereis php

The simplest method is to detect processes.
Ps-ef | grep php
The paths listed below are basically.

Hahascho 833 30068 1? 00:00:00/usr/local/php5/bin/php-cgi
Zoefiona 913 30613 1? 00:00:00 [php-cgi]
Ggbootbl 990 32677 62? 00:00:30 [php-cgi]
Ggbootbl 1159 974 64? 00:00:21/usr/local/php5/bin/php-cgi
Zoefiona 1323 865 11? 00:00:01/usr/local/php5/bin/php-cgi
Cawennet 1384 969 1? 00:00:00/usr/local/php5/bin/php-cgi
Ictgu 1419 668 2? 00:00:00 [php-cgi]
Haoguior 1423 1417 11? 00:00:00 [php-cgi]
Gckzeduc 1458 1428 9? 00:00:00 [php-cgi]
Ictgu 1484 973 0? 00:00:00/usr/local/php5/bin/php-cgi
Ictgu 1485 32688 0? 00:00:00/usr/local/php5/bin/php-cgi

Thanks. I used this command on corn to export the above result to determine that the binfile should be/usr/local/php5/bin/php-cgi.
However, I still cannot run in corn using this command and the php path.

It's correct to use whereis php.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.