This is for a MacOSX. I need to put a line in the php.ini
file for PHP 5.6 - however, I have found out from this:
php -r "php_ini_loaded_file();"
That PHP is not using an ini file!
OK, so that was a surprise.. how do I either tell PHP to use an ini file, or add the line I would have added in that ini file? Thanks!
-- EDIT --
Using php --ini
gives me the same thing.
samuelfullman$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
You can find the command-line switches in the manual or with the help switch:
php -h
I believe you want one of these:
-c <path>|<file> Look for php.ini file in this directory
-d foo[=bar] Define INI entry foo with value 'bar'
Otherwise, PHP will search for the php.ini file according to the documented rules . I understand that CLI interface makes use of the PHPRC
environment variable if it exists.
The following worked for me. I typed
php --ini
which also told me that there was no config file, but it DID tell me the default directory was /etc
.
So I did a sudo nano /etc/php.ini
and added a comment (starting with a ;
) and did php --ini
again - and it showed the file was present! Just to be sure, I added some illegal characters, and went back to php --ini
which told me there was a parse error.
So it appears you can always add a php.ini file - even if it starts out blank.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.