XAMPP + Zend Framework = .phtml files do not display

I have a XAMPP installation and an application built on the Zend Framework that runs in a normal apache2 + php5 environment. The application is in a properly configured vhost, and as a precaution, I also added .phtml files to match the php compiler

<FilesMatch "\.php$|\.php5$|\.php4$|\.php3$|\.phtml$|\.phpt$">
    SetHandler application/x-httpd-php
</FilesMatch>

When I access any page of the application, I get php code displayed in the browser instead of the displayed html. The PHP files are compiled, so die ('aaa') anywhere before rendering works as expected. But when Zend_View includes a script file in the _run () method, everything is displayed in the browser as text.

I tested with a simple index.phtml file in the test directory and it acts like a php file. it is interpreted by php.exe, but when zend contains view scripts, I cannot understand what is happening.

Can anyone help?

+3
source share
2 answers

I found where the problem is after 3 hours .. I can’t believe it took me such a long time, but the configuration problem did not allow php_short_tag, which is a great opportunity when working with templates.

I included a short tag in php.ini and restarted apache:

short_open_tag = On

I posted an answer here because one day someone might have problems.

+11
source

, vhost. xampp install phtml php. XAMPP PHP:.php.php5.php4.php3.phtml.phpt

c:/xampp/apache/conf/extra/httpd-xammp

PHPINIDir "C:/xampp/php"
LoadModule php5_module "C:/xampp/apache/bin/php5apache2_2.dll"
AddType text/html .php .phps .php5 .php4 .php3 .phtml .phpt
+3

Source: https://habr.com/ru/post/1732510/


All Articles