Announcement

Collapse
No announcement yet.

How to find the location of php.ini in linux

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to find the location of php.ini in linux

    There are multiple ways to find the location of php.ini on your linux os.


    If you don't have access to command line the best way to find this is: create a php file and add the following code:

    Code:
    <?php phpinfo(); ?>
    and open it in browser, it will show the file which is actually being read!


    On the command line execute:

    Code:
    php --ini
    You will get something like:

    Code:
    Configuration File (php.ini) Path: /etc/php5/cli
    Loaded Configuration File: /etc/php5/cli/php.ini
    Scan for additional .ini files in: /etc/php5/cli/conf.d
    Additional .ini files parsed: /etc/php5/cli/conf.d/curl.ini,
    /etc/php5/cli/conf.d/pdo.ini,
    /etc/php5/cli/conf.d/pdo_sqlite.ini,
    /etc/php5/cli/conf.d/sqlite.ini,
    /etc/php5/cli/conf.d/sqlite3.ini,
    /etc/php5/cli/conf.d/xdebug.ini,
    /etc/php5/cli/conf.d/xsl.ini

    Few more commands:

    Code:
    php -i | grep 'php.ini'
    You should see something like:

    Code:
    Loaded Configuration File => /usr/local/lib/php.ini
    p.s. To get only the php.ini path

    Code:
    php -i | grep /.+/php.ini -oE

    Code:
     php -r "phpinfo();" | grep php.ini
    Code:
     find / -name php.ini
    Last edited by DaMysterious; 04-24-2019, 01:48 PM.
Working...
X