d4ryl3
d4ryl3

Reputation: 272

Where does PHP get its settings if no configuration file is loaded?

I have set up PHP 5.3.10 on a RHEL 4 server.

When I ran php -i | grep "Loaded" it returned

Loaded Configuration File => (none)

It's OK with that setup. PHP is working the way we needed it to. I just need to know, if no php.ini is being used, where does PHP get all its settings? Thanks.

Update: I realized this after I hit submit. Sorry, how do I move this to Stack Overflow? -_-

Update 2: Result of php --ini:

Configuration File (php.ini) Path: /usr/local/lib Loaded Configuration File: (none) Scan for additional .ini files in: (none) Additional .ini files parsed: (none)

Upvotes: 14

Views: 17312

Answers (3)

fe_lix_
fe_lix_

Reputation: 938

If there is no php configuration file loaded it just takes the default values. Please check the documentation to have the list of the default values :

http://php.net/manual/en/ini.core.php

Upvotes: 5

bakytn
bakytn

Reputation: 364

First of all you got to understand that command line PHP uses another php.ini. And Apache (or NGINX etc.) module uses another php.ini.

You may try use more reliable command: php --ini rather than php -i to make sure it's not loading any configs.

Usually it loads php.ini from /etc/php5

If the command is not showing you anything, so you may try to add that file (/etc/php5/cli/php.ini) manually and check.

In RedHat it may be directly on /etc/ directory.

Upvotes: 2

Kevin Fegan
Kevin Fegan

Reputation: 1290

It may depend on your server setup.

It could be (depending on PHP version) that the PHP configuration is controlled from within the Apache configuration files: How to change configuration settings

You can use the phpinfo() function to view your PHP configuration settings (including the config file directory). Create a file called info.php (for example in the folder that is the "DocumentRoot"), and edit the file to contain the following code:

<? phpinfo(); ?>

So, if your domain is:

http://example.com

And your "DocumentRoot" is:

".../www" or  ".../public_html"

Place the file in that folder and then using a browser, go to:

http://example.com/info.php

This should show you all the settings.

Upvotes: 2

Related Questions