Author Topic: PHP not rendering properly  (Read 5318 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
PHP not rendering properly
« on: October 18, 2020, 10:27:04 PM »
Hi,

Apache doesn't recognize PHP files or PHP scripts embedded within HTML.  All PHP code is displayed within web pages as text and is not rendered by the PHP engine.  Here is what I have:

  PHP 5.6.37
  Apache 2.4.39
  CentOS 7.8.2003

I have tried the following in order to get Apache to recognized the file types:

  httpd.conf:

    <FilesMatch \.(html|php)$>
       SetHandler application/x-httpd-php56
    </FilesMatch>

  .htaccess:
 
     AddHandler application/x-httpd-php56 .php .html .htm

These directives did not fix the issue.  I tried different suggestions from other forums too, but no success there either.

I did recompile both Apache and PHP (in that order) with no change.  I suspect the issue may be that the libphp5.so module cannot be found anywhere on my server, and there is no associated LoadModule command in the httpd.conf file (LoadModule php5_module modules/libphp5.so).  Thus, it seems Apache doesn't know that PHP even exists.

Any ideas how to recompile so that this module will be included?  Or ideas how to obtain this module so that I can move on with development?  Could it be a LAMP issue?  Any help is appreciated...

Thank you

Offline
*
Re: PHP not rendering properly
« Reply #1 on: October 19, 2020, 04:09:41 PM »
I decided to recompile PHP to 7.4.11 and had to select the DOS-HANDLER option in order to compile the php_mod components correctly.

This issue has been resolved at this time!

The DOS-HANDLER should be selected by default.

Offline
*
Re: PHP not rendering properly
« Reply #2 on: August 27, 2021, 11:20:33 AM »
Hi,

My php code not working in .HTML file since I switched from apache only to nginx + varnsh + apache

it is showing PHP code instead rendering