Where can I find php.ini?

后端 未结 14 2319
無奈伤痛
無奈伤痛 2020-11-22 11:58

A few years ago I installed Apache 2.2x and PHP 5.3.1 on a Linux server I maintain. I used .tar.gz\'s and built them as instructed (instead of rpms and what-have-you). And

相关标签:
14条回答
  • 2020-11-22 12:06

    There are several valid ways already mentioned for locating the php.ini file, but if you came across this page because you want to do something with it in a bash script:

    path_php_ini="$(php -i | grep 'Configuration File (php.ini) Path' | grep -oP '(?<=\=\>\s).*')" echo ${path_php_ini}

    0 讨论(0)
  • 2020-11-22 12:07

    This works for me:

    php -i | grep 'php.ini'
    

    You should see something like:

    Loaded Configuration File => /usr/local/lib/php.ini
    

    p.s. To get only the php.inin path

    php -i | grep /.+/php.ini -oE
    
    0 讨论(0)
  • 2020-11-22 12:07

    This command should help you to find it

    php -r "phpinfo();" | grep php.ini
    
    0 讨论(0)
  • 2020-11-22 12:15

    Run this in the command line:

    php -r "echo php_ini_loaded_file().PHP_EOL;"
    
    0 讨论(0)
  • 2020-11-22 12:17

    Use the following commands to find the php.ini file path in linux.

    [root@AnyDirectory ~]# locate php.ini
    /etc/php.ini
    /etc/php.ini.rpmnew
    /usr/share/doc/php-common-5.4.45/php.ini-development
    /usr/share/doc/php-common-5.4.45/php.ini-production
    


    or try this another way

    [root@AnyDirectory ~]# php --ini
    its shows the path result

    0 讨论(0)
  • find / -name php.ini
    

    Hey... it worked for me!

    0 讨论(0)
提交回复
热议问题