1

This question already has an answer here:

I am trying to find the php.ini file on Ubuntu server with the command:

sudo vim /etc/php5

However, this tells me that the file does not exist. How can I find and edit the php.ini file?

marked as duplicate by Eric Carvalho, edwinksl, Fabby, Zanna, TheWanderer Aug 24 '17 at 11:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    use locate php.ini I found mine that way. – Alvar Dec 26 '13 at 13:30
  • try sudo nano /etc/php5/apache2/php.ini then when you're done making changes, type ctrl+x to close, and then y to save. – viktorstrate Apr 17 '14 at 10:25
  • askubuntu.com/a/356990/582516 – Kris Roofe Aug 15 '17 at 3:32
3

If you're using apache2, it's located in /etc/php5/apache2.

2

With ubuntu find command

sudo find / -name "php.ini"

or you can see the phpinfo page

enter image description here

1

The other answers can correctly locate php.ini files in the system, but to find out which one is used by the process you are running, you can use the php_ini_loaded_file() function.

Note that the file loaded is different depending on how you invoke php (apache, nginx, command line, etc).

This information is also available through phpinfo()

Not the answer you're looking for? Browse other questions tagged or ask your own question.