NYCPHP Meetup

NYPHP.org

[nycphp-talk] Apache 2.2, PHP 5.2 and .htaccess

Peter Sawczynec ps at blu-studio.com
Tue Oct 18 21:09:16 EDT 2011


The index.html page comes up, but I see in the source that several 

php snippets such as  this <?php include(some.php) ?> are actually printing
out

so the directives are not working 

 

I tried this:

DirectoryIndex index.html

AddType php5-fastcgi .htm .html

AddHandler php5-fastcgi  .htm .html 

 

Does nothing.

 

And this: 

DirectoryIndex index.html

AddType x-httpd-php5 .htm .html

AddHandler x-httpd-php5  .htm .html

 

Produces HTTP 403 Forbidden error page

 

Warmest regards, 

 

Peter Sawczynec 

Technology Dir.

blūstudio 

941.893.0396

 <mailto:ps at sun-code.com> ps at blu-studio.com 

 <http://www.blu-studio.com> www.blu-studio.com 

 

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Rob Marscher
Sent: Tuesday, October 18, 2011 8:56 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Apache 2.2, PHP 5.2 and .htaccess

 

On Oct 18, 2011, at 8:14 PM, Peter Sawczynec wrote:

I am running a legacy website where all the .html files are being served as
php by using some directives in an .htaccess file as follows:

 

DirectoryIndex index.html

AddType application/x-httpd-php .htm .html

AddHandler x-httpd-php  .htm .html

 

This website has now been migrated to a newer Apache 2.2 and PHP 5.2 web
server environment and the above directives fail.

 

Does anyone know the directives that will work for me?

 

I'm not exactly sure why it's not working for you.  I use those directives
on Apache 2.2.17 on my mac.

 

Does "apachectl configtest" give you any errors or warnings?  Where do you
place those directives?  Top-level, virtual host, directory, htaccess?

 

On Oct 18, 2011, at 8:32 PM, Peter Sawczynec wrote:

this is a virtual host environment.

I am actually running drupal 7 in a multi-site configuration at the top
level.

in an immediate subdirectory I have this legacy site with the html pages as
php.

the .htaccess file is in that subdirectory

 

Does anything work in your .htaccess file?  Maybe AllowOverride is turned
off so the .htaccess files aren't being processed.

 

Are you seeing your php code output to the page?  That's what I think would
happen if the AddType/AddHandler directives aren't working.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20111018/92b59d1e/attachment.html>


More information about the talk mailing list