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
Possibly Related Posts:



Recent Comments