Where is php.ini located in linux or windows server?

The location of the php.ini file depends on the Linux distribution (windows distribution does not have a major impact) you are using (RHEL, Ubuntu, etc), PHP version and how it has been installed with the Apache web server. Normally the php.ini file are stored in one of the following (but not limited to) locations in a linux machine:

/etc/php.ini
/etc/php/php.ini
/usr/bin/php5/bin/php.ini
/usr/local/lib/php.ini

One of the best methods to locate the php.ini file in windows or linux, is to create a test script file. If you don’t know how to create one, then use the below code.

<?php
phpinfo();
?>

Run the php script in your favorite browser and look for Loaded Configuration File in the table that looks like the one below. The phpinfo function will display many details about your php installation and here you will find the location of your php.ini file

System Windows NT ABC-PC
Build Date Jun 29 2009 21:23:30
Compiler MSVC6 (Visual C++ 6.0)
Architecture x86
Configure Command *** Hidden ***
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File D:\wamp\bin\apache\Apache2.2.11\bin\php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)

The above sample generated by phpinfo function, is from a windows machine. If this was run in a linux machine you will see the path for the php.ini file in the linux machine displayed.

Another option to find the location of php.ini on linux server is to use the find command. First of all go to the root directory and then use the find command as shown below to search for the php.ini file.

# find ./ -iname php.ini

10 comments to Where is php.ini located in linux or windows server?

  • Shawnee

    Admiring the time and effort you put into your site and in depth information you present.
    It’s awesome to come across a blog every once in a while that isn’t the same unwanted rehashed material. Excellent read! I’ve bookmarked your site and I’m
    adding your RSS feeds to my Google account.

  • Nicole

    whoah this weblog is magnificent i like studying your articles.
    Stay up the good work! You already know, many individuals are looking round for this information, you could aid them greatly.

  • Darci

    Magnificent site. Plenty of useful info here. I am sending
    it to several buddies ans also sharing in delicious. And of course,
    thank you on your sweat!

  • Phil

    I just couldn’t depart your site prior to suggesting
    that I extremely enjoyed the standard information a
    person supply in your visitors? Is gonna be
    back continuously in order to investigate cross-check new posts

  • Brooke

    I was wondering if you ever thought of changing the structure of your site?

    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having one or two images.
    Maybe you could space it out better?

  • Christin

    Hi there! I could have sworn I’ve been to this website before but after checking through some of the post I realized it’s new to me.

    Nonetheless, I’m definitely delighted I found it and I’ll be book-marking and checking back often!

  • Deandre

    Great looking website. Assume you did a whole lot of your very own html
    coding.

  • Omer

    Woah! I’m really digging the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s very difficult to get that “perfect balance” between usability and appearance.
    I must say you’ve done a awesome job with this.
    Also, the blog loads extremely fast for me on Firefox. Outstanding
    Blog!

  • Nichole

    Wow that was unusual. I just wrote an incredibly long comment but after I clicked submit my comment didn’t show up.

    Grrrr… well I’m not writing all that over again. Anyway,
    just wanted to say great blog!

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.