Where is my php ini linux?

I am currently trying to locate the correct php.ini file to edit it and restart apache so the changes will take place and I'm stumped.

I have found three different php.ini files (no idea why there are three) this is how I found the files

$ sudo find / -name php.ini
/etc/php5/cli/php.ini
/etc/php5/apache2/php.ini
/etc/php5/cgi/php.ini

I also did....

$ sudo php -i | grep 'Configuration File'
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini

I changed all of them (just to be sure) to the settings I wanted.

I restarted apache using

sudo service apache2 restart

The results...

* Restarting web server apache2

I reloaded the page and it showed that the php.ini file was not updated.

I know this because I used

echo ini_get('post_max_size');

Which was supposed to be changed to 20M but was still only 2M

I tried rebooting my computer thinking maybe that would stop the apache server and reload the php.ini file with the correct setting, but alas that attempt also failed.

Is there any chance there could be another php.ini file that could be interfering?

1 answer to this question.

Hello @kartik,

You can get a full phpinfo() using :

php -i 

And, in there, there is the php.ini file used :

$ php -i | grep 'Configuration File'
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini

On Windows use find instead:

php -i|find/i"configuration file"

Hope this is helpfull!!

Thank You!!

Where is my php ini linux?
answered May 19, 2020 by Niroj
• 82,780 points

  • All categories
  • Where is my php ini linux?
    Apache Kafka (84)
  • Where is my php ini linux?
    Apache Spark (596)
  • Where is my php ini linux?
    Azure (131)
  • Where is my php ini linux?
    Big Data Hadoop (1,907)
  • Where is my php ini linux?
    Blockchain (1,673)
  • Where is my php ini linux?
    C# (124)
  • Where is my php ini linux?
    C++ (268)
  • Where is my php ini linux?
    Career Counselling (1,060)
  • Where is my php ini linux?
    Cloud Computing (3,356)
  • Where is my php ini linux?
    Cyber Security & Ethical Hacking (145)
  • Where is my php ini linux?
    Data Analytics (1,266)
  • Where is my php ini linux?
    Database (853)
  • Where is my php ini linux?
    Data Science (75)
  • Where is my php ini linux?
    DevOps & Agile (3,500)
  • Where is my php ini linux?
    Digital Marketing (111)
  • Where is my php ini linux?
    Events & Trending Topics (28)
  • Where is my php ini linux?
    IoT (Internet of Things) (387)
  • Where is my php ini linux?
    Java (1,148)
  • Where is my php ini linux?
    Kotlin (3)
  • Where is my php ini linux?
    Linux Administration (384)
  • Where is my php ini linux?
    Machine Learning (337)
  • Where is my php ini linux?
    MicroStrategy (6)
  • Where is my php ini linux?
    PMP (423)
  • Where is my php ini linux?
    Power BI (516)
  • Where is my php ini linux?
    Python (3,154)
  • Where is my php ini linux?
    RPA (650)
  • Where is my php ini linux?
    SalesForce (92)
  • Where is my php ini linux?
    Selenium (1,569)
  • Where is my php ini linux?
    Software Testing (56)
  • Where is my php ini linux?
    Tableau (608)
  • Where is my php ini linux?
    Talend (73)
  • Where is my php ini linux?
    TypeSript (124)
  • Where is my php ini linux?
    Web Development (2,984)
  • Where is my php ini linux?
    Ask us Anything! (66)
  • Where is my php ini linux?
    Others (964)
  • Where is my php ini linux?
    Mobile Development (29)

Subscribe to our Newsletter, and get personalized recommendations.

Already have an account? Sign in.

Where is the PHP ini file in Linux?

The default location for the php. ini file is: Ubuntu 16.04: /etc/php/7.0/apache2. CentOS 7: /etc/php.

Where is my PHP ini file located?

user. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.

Where is PHP ini file in RHEL?

ini file is found at /etc/php.

How can I access PHP ini file in Ubuntu?

The path of php. ini in Ubuntu is /etc/php5/apache2 . Open the terminal and start typing following commands. To view the files present in apache2 directory, type ls command.