New virtual host local site wont recognize php
Posted by: eatc7402 (203.177.74.---)
Date: June 23, 2013 09:57AM

I've just set up my local site as a virtual host site. That works okay... just as I desire EXCEPT...

Now ANY htm file that has any php tags and code sections will not recognize ANY php in
an htm file. Regular php files wotk fine, any htm ONLY files work fine.

But any htm containing php (long OR short) tags wont recognize the php and outputs the
php as text.

Where did miss a configuration step here? The code was fine BEFORE making it a
virtual host.

eatc7402

Options: ReplyQuote
Re: New virtual host local site wont recognize php
Posted by: RiggsFolly (---.as13285.net)
Date: June 23, 2013 04:07PM

Its not actually a good idea doing that but whatever:-


Did you add a line like this to your httpd.conf file?

AddType application/x-httpd-php .html

You will find these 2 lines already exists in the httpd.conf, add the line above afre these

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3

In order to get html files parsed by PHP you need this line to tell apache to pass the .html files through the PHP interperter.

Alternatively
You can add this command

AddHandler application/x-httpd-php .html

to a .htaccess file provided you have AllowOverride ALL set for the site

Options: ReplyQuote
Re: New virtual host local site wont recognize php
Posted by: eatc7402 (180.190.251.---)
Date: June 24, 2013 03:19AM

I added all the suggested lines to my httpd.conf.

I changed the virtual site definition in my httpd-vhosts.conf from AllowOverride NONE to
AllowOverride ALL.

I added AddHandler application/x-httpd-php .html to my .htaccess file for the site at
it's root branch.

NONE of that fixed the problem. It remains the same.... any php code inside an htm file
outputs as TEXT.

eatc7402

Options: ReplyQuote
Re: New virtual host local site wont recognize php
Posted by: eatc7402 (180.190.251.---)
Date: June 24, 2013 03:27AM

Problem solved.

I discovered some missing port definitions missing for the new virtual web sites in my PHP IDE.
The php now functions as normal.

Thanks\.

eatc7402

Options: ReplyQuote


Sorry, only registered users may post in this forum.