1

I'm trying to make Apache 2.4 work with PHP 5.6 on Windows 8.1.

I added the usual lines to httpd.conf:

LoadModule php5_module "c:/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "c:/php"

And it works, displaying phpinfo properly on my test.php page (which is just Hello! <? phpinfo(); ?>)... if php.ini doesn't exist in c:\php. (Presumably PHP is using a default configuration, which I need to change to include mysql.) Once I create php.ini, Apache fails to execute the PHP function, instead just displaying the page as text.

The Apache server doesn't seem to think anything is wrong; on restarting httpd, error.log just displays

AH00455: Apache/2.4.10 (Win64) PHP/5.6.4 configured -- resuming normal operations

php.ini is just the php.ini-production file included with the install, renamed. If I introduce errors into it on purpose, they show up in the Apache log.

What could be causing Apache to not run my page as a PHP file?

1 Answer 1

1

I figured it out: PHP defaults to short_open_tag=On, so my test worked with no config file. But the default php.ini files have short_open_tag=Off, so my test.php was incorrect: it should have been Hello! <?php phpinfo(); ?>).

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

Comments

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.