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

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:

  1. Adding Virtual Disks to a Linux Virtual Machine in VMWare
  2. Check if a process is running and execute a program in Linux using shell script
  3. Adding Virtual Disks to a Windows Virtual Machine in VMWare
  4. Creating an Email Server with Sendmail and Dovecot – Part 1
  5. Setting up a git repository

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=""> <strike> <strong>

*