Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Oct 2003
    Location
    Hosting from: Panama, Hong Kong, Singapore, Malaysia, China, India, USA and Australia
    Posts
    68

    Default .php includes in .html files?

    I am moving a site from a plesk system to a cpanel system. In plesk, the site was built using filename.html container pages and the "included" content of those pages is filename.php etc...

    php includes are being parsed from .html pages somehow by the server on the plesk system.

    include("hosting-x.php")

    ex.
    filename.html
    include("filename.php")
    filename.php

    Now, being that I do not want to try and attempt to rename all the html pages to .php and rename thousands of includes on hundreds of pages does anyone here have a work around for this situation?

    If plesk can parse php via html there must be a config setting for this right?

    thank you

  2. #2
    Member
    Join Date
    Apr 2004
    Location
    London - UK
    Posts
    45

    Default

    I think you can just assign a handler for html files to be parsed by php in cpanel "Apache Handlers" section..

    Otherwise:

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

    in httpd.conf

  3. #3
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Oct 2003
    Location
    Hosting from: Panama, Hong Kong, Singapore, Malaysia, China, India, USA and Australia
    Posts
    68

    Default

    I added a line into the httpd.conf file and restarted apache and now am getting a 500 error on all html files. I played with the permissions of the files and no luck yet:

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

    <<< NEW LINE >>>

    AddType application/x-httpd-php .html

    <<< END NEW LINE >>>

    AddType application/x-httpd-php-source .phps
    AddType application/x-httpd-php .phtml
    AddHandler cgi-script .cgi .pl
    AddType text/html .shtml
    AddType application/x-tar .tgz
    AddType text/vnd.wap.wml .wml
    AddType image/vnd.wap.wbmp .wbmp
    AddType text/vnd.wap.wmlscript .wmls
    AddType application/vnd.wap.wmlc .wmlc
    AddType application/vnd.wap.wmlscriptc .wmlsc


    is the added line above correct, and/or in the correct place?

    I chmoded the html file to:

    644 and get this

    [2004-05-14 06:20:18]: error: file has no execute
    [2004-05-14 06:18:49]: error: file has no execute
    [2004-05-14 06:18:46]: error: file has no execute

    777 = gets this
    [2004-05-14 06:22:39]: error: file is writable by others:
    [2004-05-14 06:22:38]: error: file is writable by others:

    chmod 755 gives the 500 error.

    On plesk I always had to chmod 755 to make it work.

    any ideas?

  4. #4
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Oct 2003
    Location
    Hosting from: Panama, Hong Kong, Singapore, Malaysia, China, India, USA and Australia
    Posts
    68

    Default

    nevermind...

    I added the handler also and it came right up.

    Now the question remains: are both the httpd.conf and apache handler required or only the handler?

    Since the handler is site specific, how can it be configured globally?

    Scott

  5. #5
    Member bamasbest's Avatar
    Join Date
    Jan 2004
    Posts
    531

    Default

    to make it global, don't specify the handler within a virtual account.

    modify/add your runtime directive where the global directives exist.

    Then, it would apply server wide.

  6. #6
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Oct 2003
    Location
    Hosting from: Panama, Hong Kong, Singapore, Malaysia, China, India, USA and Australia
    Posts
    68

    Red face

    isnt that already being discussed? The question is what file and what code specifically, not how or why.

    It was said that adding a line to https.conf would do it, but that proved wrong on its own.

    I have heard that a .htaccess file can do it, but that is site specific.

    I head that ssi can do it, but that is again site specific.

  7. #7
    Member
    Join Date
    Oct 2003
    Posts
    1,020

    Default

    Originally posted by katz_global
    It was said that adding a line to https.conf would do it, but that proved wrong on its own.
    I assume you meant httpd?

    That should work as long as there is no conflict within your virtual account settings.

    Originally posted by katz_global
    I head that ssi can do it, but that is again site specific.
    Parsing the .html file for SSI would require almost essential the same changes as parsing for PHP.


    Parsing all .html files for PHP will severly increase your server load on an active server. Is that really what you want to do? You may be better off simply parsing .html files for those clients that need it and for whatever reason can or will not stand to rename their files.

  8. #8
    Member
    Join Date
    Jul 2003
    Location
    SW London (UK)
    Posts
    50

    Default

    A similar problem is being discussed at http://forums.cpanel.net/showthread.php?t=22936

    This problem appear to be more common than I had first thought. I would also recommend against parsing all html files with php as it will definately increase server load. There has to be a neater answer.

  9. #9
    Member
    Join Date
    Aug 2004
    Posts
    198

    Default

    Here's the full scoop...

    Add the following line to your .htaccess file (NOT IN THE CONF FILE) in the directory you want to parse html as php.

    AddType application/x-httpd-php .html
    THIS IS A HACK because your server will parse EVERY html page whether there is php in it or not. Thus, eventually degrading server performance...

    You would be better off doing apache includes if possable. On pretty much every Cpanel server I've ever seen...you can do an SSI include using the following code in your SHTML (note I said SHTML not HTML) file~

    <!--#include virtual="/cgi-bin/example.cgi?argument=value" -->
    Note that the .html is changed to .shtml so that the server does not parse every HTML page as an SSI page. SHTML is used by the server to parse apache includes. Following this file naming structure for the type of file you are using is a good idea, so that a server move in the future will be easy -since almost every server follows the same scheme...

    The only difference between SHTML and HTML is that SHTML is parsed by the server.

    Hope that helps~

  10. #10
    Member tomakaze's Avatar
    Join Date
    Oct 2004
    Location
    Toronto, CA / Helsinki, FI
    Posts
    9

    Default php parsing from .html (separate cpanel apache config?)

    I already have my Apache set to parse PHP from html files, I'm not concerned about possible performance issues.

    The problem is, that cPanel is not playing by the right Apache configuration, and after many experiments, I'm convinced that cpanel has it's own configuration and it's own unique instance of apache.

    There is a file that I'm a bit suspicous of: /usr/local/cpanel/APACHE_CONFIG

    But that doesn't seem to do the job when I add the handlers or type.

    My installation of cPanel won't even deliver a PHP file properly to my browser, so I know there is something going on designed only for the standard cpanel skins.

    And then beyond this, there seems to be still general problems with limitations of php within the cpanel framwork. Juan Poze has created this php wrapper to get around some of these: http://html.conclase.net/cp/scripts/#cpanelphp

    I want to know how we can all untie our hands from these issues and have a more open environment. I guess cpanel doesn't care about that, but I do, and I bet many of you do too!

Similar Threads & Tags
Similar threads

  1. SuPHP Question - making .html files behave as .php files
    By Doug E in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 09-02-2010, 10:47 AM
  2. HTML files via PHP engine?
    By doni49 in forum New User Questions
    Replies: 1
    Last Post: 02-25-2007, 11:37 AM
  3. Output Filter & .HTML INCLUDES SUPPORT
    By Evren Bilen in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-08-2003, 06:07 AM
  4. Output Filter & .HTML INCLUDES SUPPORT
    By Evren Bilen in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 03-06-2003, 11:27 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube