SEARCH

How-To Geek

Find the php.ini File Location from the Command Line

Ever needed to make a quick adjustment to the php.ini file but you weren’t sure where it was? Here’s a quick command you can use:

php -i | grep php.ini

What this does is tell the php command-line application to run a phpinfo() and output it in text format to the shell. Then filtering it through grep to find the actual line, which will display like so:

Configuration File (php.ini) Path => /etc/php.ini

You can, of course, always put a new php file in your web server root directory and add in the following:

<?php

phpinfo();

And then browse to it in your browser.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 08/5/10

Comments (2)

  1. eric db

    #ftw

    Just what I needed, thanks.

  2. wk

    display php.ini via shell command:

    $ php –ini

    regards
    wk

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!