Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Apr 27, 2012 11:32 am 
Offline
Senior Newbie

Joined: Thu Apr 26, 2012 6:08 am
Posts: 7
Hi,

I have just setup a 512 linode account with LAMP stack for Ubntu 10.04 LTS and followed guides by linode to setup sites.

Everything is working fine but I want to run PHP code under html files for that I have tried adding

AddHandler application/x-httpd-php5 .php .html .htm

in .htaccess file and sites_available/virtualhost file as well but its not working, view source html file shows php code in it and not being parsed at server.

please help!


Top
   
 Post subject:
PostPosted: Fri Apr 27, 2012 12:23 pm 
Offline
Senior Member
User avatar

Joined: Tue Mar 17, 2009 5:11 am
Posts: 129
Location: UK
Have you tried restarting apache since adding the new handler?


Top
   
 Post subject:
PostPosted: Fri Apr 27, 2012 1:06 pm 
Offline
Senior Newbie

Joined: Thu Apr 26, 2012 6:08 am
Posts: 7
yes I have restarted and reloaded apache number of times but no effect.


Top
   
 Post subject:
PostPosted: Fri Apr 27, 2012 6:27 pm 
Offline
Senior Member
User avatar

Joined: Tue Jan 04, 2005 7:32 am
Posts: 277
Website: http://www.betadome.com/
Location: Ă…lesund, Norway
Skype: neonnero
Twitter: neonnero
Following the pattern from /etc/apache2/conf.d/php5.conf (which may or may not be a relic from a previous version, since it was last changed back in 2008 on my system, which was around the time I set up that Linode), you could try with the following in your .htaccess:
Code:
  AddType application/x-httpd-php .html .htm

If that doesn't work, you could instead try the following in .htaccess (pattern found in /etc/apache2/mods-available/php5.conf):
Code:
    <FilesMatch "\.html?$">
        SetHandler application/x-httpd-php
    </FilesMatch>

Either of these versions will match both .htm and .html file extensions.


Top
   
 Post subject:
PostPosted: Fri Apr 27, 2012 10:07 pm 
Offline
Senior Newbie

Joined: Thu Apr 26, 2012 6:08 am
Posts: 7
Thanks a lot ... it worked ... earlier I was trying AddType application/x-httpd-php5 .php .html .htm which prompted me to download files.

But can you guide me about how to add this line in httpd.conf or php5.conf (dont not exists), so I dont have to add this line in every .htaccess?


Top
   
 Post subject:
PostPosted: Mon Apr 30, 2012 12:37 pm 
Offline
Newbie

Joined: Fri Apr 27, 2012 1:44 pm
Posts: 3
.htaccess for mod_php ^

SetEnv PHPRC /location/todir/containing/phpinifile

.htaccess for php as cgi ^

AddHandler php-cgi .php .htm
Action php-cgi /cgi-bin/php5.cgi

Shell wrapper for custom php.ini ^

#!/bin/sh
export PHP_FCGI_CHILDREN=3
exec php5.cgi -c /abs/php5/php.ini



That's a little guide of what you have to use your htaccess

Regards


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group