EasyApache stuffs up PHP on subdomains only (browser wants to download)

Starcraftmazter

Well-Known Member
May 5, 2006
51
0
156
Hi

I have just recompiled everything with easyapache 4 (probably first time in 1.5 or so years), and just have php 7.2 and 7.3. I have also tried turning php-fpm on and off, makes no difference (for all accounts at that).

The issue is that on some or all subdomains, php files are downloaded by browser rather than executed.




I had a look at the httpd.conf, and it had a duplicate entry for that forums subdomain initially, so I removed the subdomain and added it back just with cpanel normally, and now there is indeed only one entry, but it seems like it's missing the php addhandler stuff. Now sure why it's not working here.

Any advice?

Thanks
SCM
 
Last edited by a moderator:

RoseHosting

Member
PartnerNOC
Jan 3, 2003
20
2
153
Hello Starcraftmazter

your PHP files are not being processed by the PHP, you should check your Apache Handler for PHP

you can test it also with info.php file just to display the PHP version
 

Starcraftmazter

Well-Known Member
May 5, 2006
51
0
156
@RoseHosting - yes I understand it's not being processed by PHP... and I already said the handler is not there for the subdomain vhost - my question is why would this be the case for subdomain(s) only ? I can't change the httpd.conf myself, cPanel generates and regenerates it - the question is, what would be leading it to do this behavior.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Hello @Starcraftmazter


  • I want to point out that you wouldn't ever need to "recompile" anything using easyapache 4.
    • Everything is RPM-based and compiled prior to your adding the feature.
    • Even updates to EA4 packages are done automatically with yum so no matter how long you left it, everything should continue to update.

  • As far as *why* the sites are downloading rather than displaying, it's typically something added to the .htaccess
    • Usually an invalid AddType or AddHandler.
    • One way to avoid this is to make any and all changes to the php configuration through the MultiPHP Manager within cPanel.

  • Under no circumstances should the Apache configurationbe directly modified.
 

Starcraftmazter

Well-Known Member
May 5, 2006
51
0
156
Hey @cPanelLauren

It cannot be anything to do with the .htaccess, because exactly the same code runs fine when accessed without the subdomain, as I linked to in the OP. It has to be the vhost setting.

Thanks
Max
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Well, depending on the location of the documentroot of that subdomain that line of thought could potentially be incorrect. If the documentroot is outside of the public_html an .htacess file within the public_html would not affect it.

Furthermore, depending on the handler/configuration, an .htacess isn't always read recursively but if you think it HAS to be a VirtualHost setting, and knowing you can't make changes directly to the apache configuration that would affect this, but you could potentially add the AddHandler or AddType (or related directives) in an include. That'd be the next step to check:

Individual virtual host
  • With SSL - /etc/apache2/conf.d/userdata/ssl/2_4/user/domain/includename.conf
  • Without SSL - /etc/apache2/conf.d/userdata/std/2_4/user/domain/includename.conf
 

Starcraftmazter

Well-Known Member
May 5, 2006
51
0
156
The directory for the subdomain is inside public_html indeed.

Weirdly, without me doing anything it works now, but css/js seems to be broken, even though they all seem to load, through that subdomain.