bedeabza
bedeabza

Reputation: 872

XAMPP + Zend Framework = .phtml files don't render

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 ?

Upvotes: 3

Views: 4620

Answers (2)

bedeabza
bedeabza

Reputation: 872

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.

Upvotes: 11

Elzo Valugi
Elzo Valugi

Reputation: 27856

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

Upvotes: 3

Related Questions