1. Judging that apache
first execute the command to find the httpd path
ps aux | grep httpd
If the httpd path is /usr/local/apache/bin/httpd
and then execute the following command
/usr/local/apache/bin/httpd -V | grep "SERVER_CONFIG_FILE" You
can find the configuration file path loaded at compile time httpd.conf
-V parameter can see the parameters configured at compile time
2. Judging nginx
First execute the command to find the nginx path
ps aux | grep nginx
If the nginx path is
/usr/local/nginx/sbin/nginx
and then execute the following command
/usr/local/nginx/sbin/nginx -V
is placed in the installation directory by default under conf/nginx.conf
3. To judge mysql,
first execute the command to find the mysql path
ps aux | grep mysqld
If the mysqld path is
/usr/bin/mysql
and then execute the following command
/usr/bin/mysql –verbose –help | grep -A 1 'Default options'
or
/ usr/bin/mysql --print-defaults
4、判断php加载的配置文件路径
(1)、可通过php函数phpinfo来查看,写个文件,然后用网址访问一下,查找“Loaded Configuration File”对应的值即为php加载的配置文件
(2)、如果是nginx+php配置,也可以通过查找php执行路径
ps aux | grep php
如,路径为 /usr/local/nginx/sbin/php-fpm
然后执行以下命令
/usr/local/nginx/sbin/php-fpm -i | grep “Loaded Configuration File”
即可看到php加载的配置文件
(3)、如果是apache+mod_php配置,也可以在apache配置文件中查看加载的php.ini路径。如 PHPIniDir “/usr/local/apache/conf/php.ini”
当然也有简单的方法,就是通过find来搜索
如
find / -name nginx.conf
find / -name php.ini
find / -name my.cnf
find / -name httpd.conf
这种找发要经过刷选才行