Antworten auf Ihre häufigsten Fragen

[cPanel] Wie kann ich die PHP Version ändern?

English Version below

Dieser Artikel richtet sich an Kunden mit einem cPanel Hosting Produkt.

Wie ändere ich die PHP Version für meine Domains?
PHP-Version für einzelne Verzeichnisse/Domains separat ändern

 

Wichtiger Hinweis für Ihre Domains:

1. Die PHP-Version, die Sie über "Mein Hosting" einstellen, gilt global für alle Domains, sofern für einzelne Domains keine abweichende PHP-Version über eine .htaccess-Datei festgelegt wurde.

2. Greift die ausgewählte PHP-Version für Ihre Domain nicht?
Prüfen Sie, ob im Verzeichnis Ihrer Domain eine .htaccess-Datei mit einer abweichenden PHP-Einstellung vorhanden ist. Dafür können Sie den Dateimanager von cPanel verwenden. Beachten Sie, dass versteckte Dateien im Dateimanager zunächst eingeblendet werden müssen (siehe Punkt 10 im verlinkten FAQ-Artikel). Die Datei können Sie anschließend im Dateimanager bearbeiten. Sie haben zwei Möglichkeiten:

  • Ändern Sie die PHP-Version direkt in der .htaccess-Datei.
  • Entfernen Sie den entsprechenden Eintrag und speichern Sie die Datei. Anschließend gilt die globale PHP-Version.

 

Wie ändere ich die PHP Version für meine Domains?

Sie haben die Möglichkeit über die Mein Hosting Seite die PHP Version global für alle Domains zu ändern. Dies greift nur für die einzelnen Domains, sofern keine abweichenden PHP Einstellungen per htaccess eingerichtet wurden.  

Produktverwaltung - cPanel Webhosting - cPanel Login

Dies können Sie unter Einstellungen und dem Reiter "Server" ändern.

Damit wird diese für das komplette cPanel Hosting übernommen.

 

PHP-Version für einzelne Verzeichnisse/Domains separat ändern

Die PHP Version lässt sich über den oben erläuterten Menüpunkt "PHP-Version wählen" nicht für einzelne Verzeichnisse/Domains ändern.

Hinweis: Es ist nicht möglich die Einstellung per Domain direkt im cPanel unter PHP-Version wählen - Domänen-Einstellungen vorzunehmen. Dieser Menüpunkt ist serverseitig deaktiviert und steht daher nicht zur Verfügung. Dies ist jedoch mit einer .htaccess Datei in dem jeweiligen Verzeichnis der Domain möglich.

 

Erstellen Sie dazu bitte eine Textdatei mit dem Namen .htaccess mit folgendem Inhalt und laden diese dann per FTP in das Verzeichnis der Domain bzw. in das gewünschte Unterverzeichnis.


PHP 7.3

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php73___lsphp
</FilesMatch>


PHP 7.4

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php74___lsphp
</FilesMatch>


PHP 8.0

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php80___lsphp
</FilesMatch>


PHP 8.1

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php81___lsphp
</FilesMatch>

 

PHP 8.2

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php82___lsphp
</FilesMatch>

 

PHP 8.3

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php83___lsphp
</FilesMatch>

 

PHP 8.4

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php84___lsphp
</FilesMatch>

 

PHP 8.5

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php85___lsphp
</FilesMatch>

 

Diese Einstellung gilt dann automatisch für alle Unterverzeichnisse, solange nicht eine neue .htaccess mit einem anderen Wert gesetzt wird.

Sie können alle PHP-Versionen auswählen, die auch im cPanel angezeigt werden.

 

 

 

English Version:

This article is aimed at customers with a cPanel hosting product.

How do I change PHP version for my domains?
Change the PHP version for individual directories/domains 

 

Important note about your domains:

1. The PHP version, you select under "Mein Hosting" applies globally for all domains unless a different PHP version has been set for an individual domain in a htaccess file. 

2. Does the selected PHP version not take effekt for your domain?
Check whether a htaccess file in your domain's directory contains a different PHP version setting. You can use the cPanel File Manager to do this. Please note that hidden files must first be made visible in the File Manager (see section 10 of the linked FAQ article). You can edit the file in the File Manage. You have two options:  

  • Change the PHP version directly in the htaccess file.
  • Remove the relevant entry and save the file. The global PHP version will then apply. 

 

How do I change PHP version for my domains?

You can change the PHP version globally for all domains via My Hosting page. This setting applies to each domain unless a different PHP version has been cofigured in a htaccess file.

Product admin - cPanel Webhosting - cPanel login

You can change this under Settings and the “Server” tab.

This will be applied for the entire cPanel hosting.

 

Change the PHP version for individual directories/domains 

The PHP version cannot be changed for individual directories or domains using the “Select PHP Version” menu described above. 

Note: You cannot configure the PHP version for individual domains in cPanel under Select PHP Version - Domain Settings. This menu option is disabled on the server and is therefore unavailable. However, you can set the PHP version using a .htaccess file in the relevant domain’s directory.

 

Please create a textfile with the filename .htaccess and one of the following contents. Please upload the file in the directory of your domain or in the desired subdirectory.

PHP 7.3

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php73___lsphp
</FilesMatch>


PHP 7.4

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php74___lsphp
</FilesMatch>


PHP 8.0

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php80___lsphp
</FilesMatch>


PHP 8.1

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php81___lsphp
</FilesMatch>

 

PHP 8.2

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php82___lsphp
</FilesMatch>

 

PHP 8.3

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php83___lsphp
</FilesMatch>

 

PHP 8.4

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php84___lsphp
</FilesMatch>

 

PHP 8.5

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php85___lsphp
</FilesMatch>

 

This setting then automatically applies to all subdirectories, as long as a new .htaccess with a different value is not set.

You can select all PHP versions that are also displayed in the cPanel.