Where can I find php.ini?

后端 未结 14 2450
無奈伤痛
無奈伤痛 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:23

    PHP comes with two native functions to show which config file is loaded :

    • php_ini_loaded_file return the loaded ini file
    • php_ini_scanned_files return a list of .ini files parsed from the additional ini dir

    Depending on your setup, Apache and CLI might use different ini files. Here are the two solutions :

    Apache :

    Just add the following in a php file and open it in your browser

    print php_ini_loaded_file();
    print_r(php_ini_scanned_files());
    

    CLI :

    Copy-paste in your terminal :

    php -r 'print php_ini_loaded_file(); print_r(php_ini_scanned_files());'
    

提交回复
热议问题