Arvixe Web Hosting

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

SystemWindows NT ABC-PC
Build DateJun 29 2009 21:23:30
CompilerMSVC6 (Visual C++ 6.0)
Architecturex86
Configure Command*** Hidden ***
Server APIApache 2.0 Handler
Virtual Directory Supportenabled
Configuration File (php.ini) PathC:\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

Be Sociable, Share!

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

  • 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!

  • 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!

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>

*