Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 13th February 2012, 00:39
MainStreetJames MainStreetJames is offline
Junior Member
 
Join Date: Feb 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ISPConfig & nginx - PHP Inside HTML Files Not Executing

Hi,
Today's my first day with ISPConfig. I'm running ISPConfig 3.0.4.2 & nginx 1.0.12 on CentOS 6.2.

I am able to display HTML pages, and PHP pages, but any PHP inside of an HTML page does not execute. I realize that mixing PHP inside the HTML isn't optimal use of nginx, but I need the code to work until I get a chance to separate everything.

I've tried adding the following (copied from the '\.php$' directive) to the vhost file for the site, but when I do I get a 403 error when trying to display HTML files (with or without PHP inside):

Code:
        location ~ \.html$ {
            try_files $uri =404;
    	    include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9011;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_intercept_errors on;
        }
I've also tried adding the following to the site's php-fpm.d conf file, but it doesn't seem to make a difference:
security.limit_extensions = .php .html

I've checked the error logs in /var/log/nginx, /var/log/php-fpm & the site's log did, but there are no errors related to this issue.

I've tried changing the user from nginx to apache in the site's 'Web' tab in ISPConfig, but I still get the 403 error when the '~ \.html$' directive is in the vghost file. When I remove that directive the HTML files display properly, but the PHP inside is not executed.

Any help would be greatly appreciated.


Thanks,
MSJ
Reply With Quote
Sponsored Links
  #2  
Old 13th February 2012, 12:30
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,739 Times in 2,574 Posts
Default

Why don't you use the extension .php for these files instead of .html?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 13th February 2012, 13:08
MainStreetJames MainStreetJames is offline
Junior Member
 
Join Date: Feb 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by falko View Post
Why don't you use the extension .php for these files instead of .html?
I suppose we could (which would be a lot of work changing all references to them in the site, project lists, external references, etc), but that doesn't address the server configuration issue. Most of the pages just have a few PHP variables that get expanded in place, and they'll get the PHP separated out in the future.

Since nginx is supposed to be able to handle this - and its not really a stretch to expect a web server to do this - we'd like to be able to mix PHP with HTML when necessary.

Clearly there's a setting in the current version of nginx/php-fpm that I've missed or screwed up. I doubt it's a permissions issue because the files used for testing are identical except for extension (including location, owner & group). Also, a plain HTML file (same location, owner & group) that will display properly with the default settings will generate the 403 error when the '\.html$' directive is in place.


MSJ
Reply With Quote
  #4  
Old 14th February 2012, 13:58
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,739 Times in 2,574 Posts
Default

Not sure, but maybe you have to modify the mime.types file in the /etc/nginx directory.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 8th May 2012, 21:06
kervin kervin is offline
Junior Member
 
Join Date: May 2012
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Did you ever find the solution to this problem? I'm dealing with the same issue.

The application is a CMS that was built that way, so I have to support it.

Whenever I add support for HTML I get a 500 error from my PHP scripts.
Reply With Quote
  #6  
Old 9th May 2012, 19:37
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,739 Times in 2,574 Posts
Default

Do you use PHP open and close tags in your files (<?php and ?>)?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 11th May 2012, 20:31
kervin kervin is offline
Junior Member
 
Join Date: May 2012
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
 
Default

Thanks. My error turned out to be related to the application itself not ISPConfig. Once that was fixed I was good to go.
Reply With Quote
Reply

Bookmarks

Tags
config, ispconfig, nginx, php, php-fpm

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Centos 6.0 support Acid_Scorpion Developers' Forum 47 16th September 2011 10:36
Cron errors guimnk General 1 5th April 2011 09:20
Newly Installed ISPConfig3 on Ubuntu 8.04 : login redirect fail ? cripperz Installation/Configuration 5 22nd March 2009 12:15
ispconfig php 5 errors itamarjp Installation/Configuration 8 25th April 2008 10:20


All times are GMT +2. The time now is 15:10.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.