0

I have done this before so I'm not sure why it's not working, but I am trying to create a custom php.ini file and I have placed this within a specific directory.

For example, the default php.ini is located at:

C:\xampp\php\php.ini 

My custom one is located at:

D:\Codebase\Somedir\123\php.ini

I placed a PHP file inside the above directory and did output with phpinfo() and it still reports it as using C:\xampp\php\php.ini.

I have restarted Apache as well.

What am I doing wrong here!?

2 Answers 2

1

You can see which php.ini file is loaded running php.exe --ini. On my computer it output:

Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         C:\tools\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

If it is the wrong php.ini there, have a look to http://php.net/configuration.file

Sign up to request clarification or add additional context in comments.

Comments

0

If you're using XAMPP you can change the configuration file it loads PHP with by opening the properties.ini file in the

C:\xamp 

directory and editing the php_configuration_directory field to

D:\Codebase\Somedir\123\

Then restart apache for the changes to take effect.

If PHP is running as an apache module you could also edit httpd.conf on your apache setup and add this variable:

PHPIniDir "D:\Codebase\Somedir\123\" 

1 Comment

wouldn't that change the php.ini file for everything? I only want to use this custom php.ini for this particular directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.