views:

953

answers:

2

I have an installation of XAMPP and an application built on Zend Framework that works in a normal apache2 + php5 environment. The application resides inside a vhost correctly configured and as a precaution I also added .phtml files to match 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 the php code rendered in browser instead of the rendered html. PHP files are compiled, so a die('aaa') in any place before rendering works as expected. But when Zend_View includes the script file in method _run() everything gets outputed to browser as text.

I tested with a plain index.phtml file in a test directory and it acts like a php file. it is interpreted by php.exe, but when zend includes view scripts I can't figure out what's happening.

Can someone offer some help ?

A: 

I don't think you have to create that directive inside the vhost. A default xampp install will register phtml files for php. XAMPP passes by default files with the following extensions to PHP: .php .php5 .php4 .php3 .phtml .phpt

check this config file c:/xampp/apache/conf/extra/httpd-xammp

I have this lines

PHPINIDir "C:/xampp/php"
LoadModule php5_module "C:/xampp/apache/bin/php5apache2_2.dll"
AddType text/html .php .phps .php5 .php4 .php3 .phtml .phpt
Elzo Valugi
My default installation looks a little different:LoadFile "C:/xampp/php/php5ts.dll"LoadModule php5_module modules/php5apache2_2.dll<IfModule php5_module> <FilesMatch "\.php$|\.php5$|\.php4$|\.php3$|\.phtml$|\.phpt$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch> PHPINIDir "C:/xampp/php"</IfModule>I specified in the upper that if I execute a .phtml file separately it works, but as a view inside ZF it doesn't.
Dragos Badea
+2  A: 

I found where the problem is, after 3 hours.. I can't believe it took me that long, but the issue was configuration did not allow php_short_tag, which is a great feature when dealing with templates.

I have enabled short tag in php.ini and restarted apache:

short_open_tag = On

I've posted the answer here because someone might have my problem some day.

Dragos Badea