katz_global

Well-Known Member
PartnerNOC
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
 

chmod

Well-Known Member
Apr 20, 2004
45
0
156
London - UK
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
 

katz_global

Well-Known Member
PartnerNOC
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?
 

katz_global

Well-Known Member
PartnerNOC
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
 

bamasbest

Well-Known Member
Jan 10, 2004
531
0
166
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.
 

katz_global

Well-Known Member
PartnerNOC
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.
 

SarcNBit

Well-Known Member
Oct 14, 2003
1,001
3
168
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.
 

djmerlyn

Well-Known Member
Aug 31, 2004
201
1
168
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~
 

tomakaze

Member
Oct 12, 2004
9
0
151
Toronto, CA / Helsinki, FI
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 :rolleyes:

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! :eek: