4

I have installed Apache 2.4.12 (Win64) VC11 from Apache Lounge. Typing httpd -M tells me that php5_module is loaded and shared.

I have PHP 5.6.6 win32 VC11 Thread Safe installed.

The Apache server starts just fine, but when I type in the location of a local phpinfo file, it comes up blank. Adding any generic HTML to the file works just fine, but anything between the PHP tags is ignored. The Apache log is logging server starts and stops, but not noting any errors. The access log shows a server code 200 or 304 for any access to the phpinfo file.

Does anyone have suggestions on where to look for any addition errors?

  • 1
    Are you using standard, long-form <?php tags? What, exactly, does a bit of your php code look like while mixed into html, when it doesn't show when the page loads? Are you sure that it doesn't show up even when you "view source" on a normal test.php page? – Kzqai Mar 16 '15 at 17:32
  • I am using long format tags, and the tags and the phpinfo(); function call do appear when viewing the source. – Kevin Nowaczyk Mar 16 '15 at 17:39
  • I just "downgraded" to the 32 bit builds of the same PHP and Apache versions, and I'm seeing the same symptoms. – Kevin Nowaczyk Mar 16 '15 at 18:27
2

The issue is, there is a missing AddHandler php5-script .php in the config file.

1

First, check for your php.ini file, and if you don't have one, try to reinstall PHP then you'll have one created. Normally at that point, php will work properly. If not, then modify the short_open_tag and asp_tags values, and defintely make sure engine=on is listed in the same section.

    [PHP]
    ; This directive determines whether or not PHP will recognize code between
    ; <? and ?> tags as PHP source which should be processed as such. It is
    ; generally recommended that <?php and ?> should be used and that this feature
    ; should be disabled, as enabling it may result in issues when generating XML
    ; documents, however this remains supported for backward compatibility reasons.
    ; Note that this directive does not control the <?= shorthand tag, which can be
    ; used regardless of this directive.
    ; Default Value: On
    ; Development Value: Off
    ; Production Value: Off
    ; http://php.net/short-open-tag
    short_open_tag = Off

    ; Allow ASP-style <% %> tags.
    ; http://php.net/asp-tags
    asp_tags = Off

If apache still stops and starts, then either php5_module requires more memory than what your system has left, or its damaged.

You may also want to change the memory_limit setting. In most cases a value of 32M is ok.

Also, check the error logs and make sure error reporting is turned on. With a fresh installation of PHP, many options are explained in the php.ini file.

Another option is to check your system for disk corruption, and possibly reinstall both apache and PHP to rule out any damages to the files themselves especially if apache reports a segmentation fault. If other tasks on your computer abnormally freeze (especially the windows startup) then you might want to replace your RAM (memory chips).

  • 2
    The issue is, there is a missing AddHandler php5-script .php in the config file. – Kevin Nowaczyk Mar 16 '15 at 18:56
  • ^ That definitely does help too. That line should be automatically inserted when PHP is freshly installed. – Mike Mar 16 '15 at 20:46
0

The clue is in the comment, interestingly enough.

I am using long format tags, and the tags and the phpinfo(); function call do appear when viewing the source.

This means that the page is not being handled as PHP.

  • You do not need to reinstall
  • You do not need to downgrade
  • You do not need to panic

You do need however to get PHP being handled.

There may be a missing AddHandler php5-script .php in your config file. You can also add this to your .htaccess file (assuming your windows system is st up to acknowledge them). For example:

AddHandler php5-script .php .html .CustomExt .stuff

This would have all four of those endings sent to the PHP engine. The first one makes snese, the second is a matter of debate and the other two are doubtfull.

According to php.net other problems can be needing to add a mime type handler:

AddType application/x-httpd-php .php

This needs to be added to one of:

  • the global properties
  • the properties of the VirtualDomain you want to have PHP support added to

Read More: http://php.net/manual/en/faq.installation.php#faq.installation.processing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.