Get 30% off your WordPress Hosting with code WPSAVE10. Launch Faster. Save More!
  • 00 Days
  • 00 Hours
  • 00 Minutes
  • 00 Seconds

Why is my website's PHP code displaying directly on the page? - SIRSTEVEHQ CP

PHP code loading directly onto your site page rather than executing usually indicates an issue with the PHP version being defined on your site. Either it’s a broken definition, or the version being loaded isn’t using the correct path. When this happens, it’s best to check your site’s .htaccess files to see if you can isolate the cause.

A PHP version definition on our system should look like this by default:

#+PHPVersion
#="php74"
AddHandler x-httpd-php74 .php
#-PHPVersion

The core line is the one starting with ‘AddHandler’. If your rule looks different to the above (beyond the version number) then it’s best to remove the rule and use the PHP Version tool in your site’s package to manually set this, or copy the above code and add it to your .htaccess to replace it.

Sites migrated from cPanel often have a rule similar to this:

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
AddHandler application/x-httpd-ea-php56 .php .php5 .phtml
# php -- END cPanel-generated handler, do not edit

This isn’t a definition that would work on our system, so it would be worth removing it entirely. Once done, the site should then begin parsing the PHP code correctly and loading as normal.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How do I change PHP maximum upload file size? - SIRSTEVEHQ CP

On SIRSTEVEHQ CP Web hosting, PHP max upload file size is set to 128M by default. This can be...

What is the PHP memory_limit? - SIRSTEVEHQ CP

The PHP memory_limit is the maximum amount of server memory that each PHP script can use.  The...

Why is MySQL support missing from PHP installation? - SIRSTEVEHQ CP

Our web servers run PHP 7+ as standard. In this version of PHP the MySQL module has been replaced...

Can I use parent paths in Classic ASP? - SIRSTEVEHQ CP

ASP Parent Paths are disabled on our platform. As a result, Classic ASP scripts using "../"...

How can I show detailed ASP errors? - SIRSTEVEHQ CP

By default, Windows Server hides application errors from your website. You can override this by...