Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP.ini location on El Capitan

Simple question: where is the correct PHP.INI location in Mac OSX El Capitan?

I tried to update the one in /etc folder, but nothing changed.

like image 819
delphirules Avatar asked Dec 07 '15 12:12

delphirules


People also ask

Where is my PHP ini file?

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 xampp Mac?

ini file: Whenever we install PHP, we can locate the configuration file inside the PHP folder. If using xampp, we can find the configuration file in one or many versions, inside the path '\xampp\php'.

How do I know which PHP ini is being used?

Check php. ini in CLI (Command Line Interface): To know about php. ini, simply run on CLI. It look for Loaded Configuration File in output for the location of php.


Video Answer


4 Answers

i know three ways:

  1. php -i | grep php.ini
  2. php --ini
  3. create php file with following line: <?php phpinfo(); and open the file in the browser
like image 55
Jirson Tavera Avatar answered Oct 27 '22 00:10

Jirson Tavera


The default location on OSX El Capitan and macOS Sierra is /etc/php.ini

But if that file doesn't exist, php will use /etc/php.ini.default. Don't forget to create a copy if you want to make changes:

$ sudo cp /etc/php.ini.default /etc/php.ini   

Also, php will scan /Library/Server/Web/Config/php dir for additional .ini files

Restart Apache if you made any changes:

$ sudo apachectl -k restart  

Note: if you install PHP7, this location will change to /usr/local/etc/php/7.0/php.ini

like image 28
Simon Backx Avatar answered Oct 26 '22 22:10

Simon Backx


Simple solution

  1. create php info file in your web folder

    <?php
    
     // Show all information, defaults to INFO_ALL
    phpinfo();
    
    ?>
    
  2. open the file in browser

  3. look for

INFO_GENERAL 1 The configuration line, php.ini location, build date, Web Server, System and more.

Taken from php manual


Another option is to use

<? php_ini_loaded_file(); ?>
like image 5
davejal Avatar answered Oct 26 '22 23:10

davejal


Strange thing that phpinfo() does not display the file location, but here it is: /etc/php.ini.default

like image 3
gonza Avatar answered Oct 26 '22 23:10

gonza