Upgraded to php 5 and now having problems with https

noimad1

Well-Known Member
Mar 27, 2003
626
0
166
I just upgraded one of my servers to php5 and now I'm having a problem with the root of domains that use ssl.

Here's what I mean:

if I go to

https://mydomain.com

it pulls up the dialogue box that wants me to download the file, and the page doesn't come up.

but if I pull up

https://mydomain.com/index.html

It loads fine. Anyone else seen this before?
 

jayh38

Well-Known Member
Mar 3, 2006
1,212
0
166
I wonder if this is doing the same thing with http:// as well?

Check your index handler and be sure html files are indeed listed.

Service Configuration > DirectoryIndex Priority

Just a thought.
 

noimad1

Well-Known Member
Mar 27, 2003
626
0
166
Ahh....i think i figured it out, but now it brings up another issue. It turns out he had this in his .htaccess file:

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


so that his .html files would be parsed as php. Is there a new way to write that?
 

tkerns

Active Member
Jun 13, 2007
34
0
56
Ahh....i think i figured it out, but now it brings up another issue. It turns out he had this in his .htaccess file:

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


so that his .html files would be parsed as php. Is there a new way to write that?
Easy Apache 3 commented out those addHandler directives.
Change them to

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

and you should be good.

Tom
 

gkgcpanel

Well-Known Member
Jun 6, 2007
214
1
166
cPanel Access Level
DataCenter Provider
Easy Apache 3 commented out those addHandler directives.
Change them to

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

and you should be good.

Tom
So, why is EasyApache commenting those lines out? This just started happening to one of our servers 2 days ago, and each time I reconfigure PHP, some sites (not all of them) get the AddHandler application/x-httpd-php5 .html .htm .php line commented out. Then those sites will no longer work, the index.php file wants to keep getting downloaded instead of executed. Uncommenting those lines in .htaccess will fix the issue. However, do I have to do this for every single site that is reporting a problem??? And then do this again each time I run easyapache??

There was another threat that said I should modify the Tweak Settings to only go 2 levels deep while scanning .htaccess files. It's already set to 2 (default). And some of these sites it's happening under their public_html folder, so I don't think that's the issue...

HELP!!! I Don't want to have to do this for 1100 sites on the server.. That will take way too much time.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
If you want this to be added for all sites, you could trying putting the lines as an include at the following location:

Code:
mkdir -p /usr/local/apache/conf/userdata/std/2
In this path, std stands for the http VirtualHost entries (not the https) and 2 for Apache 2 or Apache 2.2. At that location, create a file called phphttp.conf and put the include lines. Because you are putting it at the level before the accounts, all accounts should use the include entries.

To verify the include works, you would then run:

Code:
/scripts/verify_vhost_includes
After checking out it works fine, you would check it into the system:

Code:
/scripts/ensure_vhost_includes --all-users
You may want to backup Apache first:

Code:
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak110301
After that, you could rebuild Apache and restart it:

Code:
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
I suggest having a non-working site to test that it begins working after you do the above steps.

Thanks.
 

gkgcpanel

Well-Known Member
Jun 6, 2007
214
1
166
cPanel Access Level
DataCenter Provider
Actually the global fix was to add the following line to /usr/local/apache/conf/php.conf

Code:
AddHandler application/x-httpd-php5 .php
Right above the AddType rule that was already in place. Why (on this server) it started failing after running EasyApache is the real mystery.
The other servers all work fine (and they don't have this line in php.conf either)...
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Unfortunately, that will not be a global permanent fix. Anytime EasyApache recompiles or you re-save WHM > Apache Configuration > PHP and SuExec Configuration area, the /usr/local/apache/conf/php.conf file will be overwritten. This is why I suggested an include instead to add that option for all accounts. Includes in the manner I noted do not get overwritten periodically.

Otherwise, you'll need to remember to revise the file every time you recompile Apache. Also, you might want to add the file to the exclude list in case cPanel upcp ever modifies it either:

Code:
echo "/usr/local/apache/conf/php.conf" >> /etc/cpanelsync.exclude