0

I had a WAMP environment with php installed in C:\SP\php. Every thing worked fine. I recently desired to place my php.ini file in a custom directory: C:\SP\confs\, and it didn't work.

Here are my httpd.conf directives:

PHPIniDir "C:/SP/confs/"
LoadModule php5_module "C:/SP/php/php5apache2_4.dll"

In C:/SP/confs/php.ini I had this:

extension_dir = C:\SP\php\ext
date.timezone = Africa/Lagos

Errors appeared everywhere suggesting that many functions (e.g. mysql) were undefined.

The phpinfo() showed the following:

Configuration File (php.ini) Path: C:\windows

Loaded Configuration File: C:\SP\confs\php.ini

Extension_dir: C:\php

Default timezone: UTC (with warnings like: It is not safe to rely on the system's timezone settings....)

My Server Software is : Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11

Now all this seems to suggest that my custom php.ini was found and loaded (according to phpinfo()) but somehow its directives were completely ignored in favour of some server defaults.

Now, how could this be?

1 Answer 1

1

This is an usual and annoying bug when you install apache/php even on wamp packages: it won't set your extension_dir, and hell breaks loose

Here is your bug:

Extension_dir: C:\php

Seems to me it should be c:\SP\php\ext right? check if there isn't a duplicated extension_dir setting that is overriding yours

Get into your php.ini and correct the extension_dir, it have all sorts of bugs if you leave it blank (documentation says it should use the default ext/ folder ... it doesn't)

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

6 Comments

Thanks @Caio for your attention. Like it says in the question, I have in php.ini this: extension_dir = C:\SP\php\ext. There's no other overriding extension_dir directive. And even more strange, phpinfo() lists the Loaded Configuration File as C:\SP\confs\php.ini which is the very php.ini I'm working on! Also, note that not only extension_dir, but also date.timezone is ignored.
I needed to add that, for some reason, this directive: error_log = C:\SP\php\php_errors.log is working from the same php.ini, as error messages are properly appearing there.
well beats me, it seems the correct .ini is being loaded, but it is not accepting some configurations. Try changing the php.ini? If you move it to windows root folder, it will use it there. Other than that, no idea. I don't know how you installed apache/php, do you have administrative permission on all folders? can the process access those files?
I've found the culprit! In my php.ini, somewhere below the declaration of error_log = C:\SP\php\php_errors.log, I had a line that should have been doc_root = . But instead, it was just a hanging ` = `. I guess I had inadvertently deleted the "doc_root" part, resulting essentially in a syntax error. Strange that PHP could not flag the syntax error! Anyhow, thank you @Caio for sticking with me through this.
yeah, that breaks the parser, but usually that also fails PHP load and breaks Apache. At least on my installations if anything is wrong with any config file, Apache won't start, weird
|

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.