How can I find out where the httpd.conf file is located?

前端 未结 6 821
时光取名叫无心
时光取名叫无心 2021-02-04 13:01

How can I find out the path of the httpd.conf file on apache (PHP)? I do not know whether my script will be runned in windows apache or linux, i need to know where i can find th

6条回答
  •  无人共我
    2021-02-04 13:41

    I think its not exposed to PHP. Run httpd -V in terminal and you will find it there (command name depends on your system/apache version, it can be also apache -V):

    bash-3.2# httpd -V
    Server version: Apache/2.2.22 (Unix)
    Server built:   Aug 24 2012 17:16:58
    Server's Module Magic Number: 20051115:30
    Server loaded:  APR 1.4.5, APR-Util 1.3.12
    Compiled using: APR 1.4.5, APR-Util 1.3.12
    Architecture:   64-bit
    Server MPM:     Prefork
      threaded:     no
        forked:     yes (variable process count)
    Server compiled with....
     -D APACHE_MPM_DIR="server/mpm/prefork"
     -D APR_HAS_SENDFILE
     -D APR_HAS_MMAP
     -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
     -D APR_USE_FLOCK_SERIALIZE
     -D APR_USE_PTHREAD_SERIALIZE
     -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
     -D APR_HAS_OTHER_CHILD
     -D AP_HAVE_RELIABLE_PIPED_LOGS
     -D DYNAMIC_MODULE_LIMIT=128
     -D HTTPD_ROOT="/usr"
     -D SUEXEC_BIN="/usr/bin/suexec"
     -D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
     -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
     -D DEFAULT_LOCKFILE="/private/var/run/accept.lock"
     -D DEFAULT_ERRORLOG="logs/error_log"
     -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
     -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"     <-- HERE IT IS
    

    but if you only want to know the value of some configuration variable then phpinfo(), getenv() or apache_getenv() should be enough

提交回复
热议问题