{"id":8338,"date":"2019-12-09T16:31:13","date_gmt":"2019-12-09T15:31:13","guid":{"rendered":"https:\/\/www.oderland.se\/support\/?post_type=ht_kb&#038;p=8338"},"modified":"2026-04-28T12:57:30","modified_gmt":"2026-04-28T11:57:30","slug":"how-do-i-manage-php","status":"publish","type":"ht_kb","link":"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-manage-php\/","title":{"rendered":"How do I manage PHP?"},"content":{"rendered":"\n<p>Via cPanel, you can manage a vast amount of settings for PHP; what version you use, which extensions that are active and which options should be used. In this guide, we will walk you through all of these.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Access to the settings<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Regardless of which settings you want to manage, first you need to <a rel=\"noreferrer noopener\" aria-label=\"log on to cPanel (\u00f6ppnas i en ny flik)\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-login-to-cpanel\/\" target=\"_blank\">log on to cPanel<\/a> for your webhosting account.<\/li>\n\n\n\n<li>Click <code>Select PHP Version<\/code> under  <code>Software<\/code>.<br><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2021\/01\/cpanel_icon_select_php_version.png\"><img loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"252\" class=\"wp-image-18635\" style=\"width: 729px;\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2021\/01\/cpanel_icon_select_php_version.png\" alt=\"\" srcset=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2021\/01\/cpanel_icon_select_php_version.png 729w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2021\/01\/cpanel_icon_select_php_version-300x104.png 300w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2021\/01\/cpanel_icon_select_php_version-50x17.png 50w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2021\/01\/cpanel_icon_select_php_version-60x21.png 60w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2021\/01\/cpanel_icon_select_php_version-100x35.png 100w\" sizes=\"auto, (max-width: 729px) 100vw, 729px\" \/><\/a><\/li>\n\n\n\n<li>You have now reached the interface through which you may manage PHP.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">How do I change PHP version?<\/h2>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-danger\">Keep in mind that if you have customised settings for a particular PHP version, these will not be automatically included if you switch to for example a newer PHP version. In other words, you need to adjust the settings per version.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\"><meta http-equiv=\"content-type\" content=\"text\/html; charset=utf-8\">We make sure that all installed PHP version are updated on all web hosting accounts, Agency services, and Managed Servers. Therefore, you do not need to update PHP yourself. However, it&#8217;s always a good idea to make sure that you run the newest PHP version that your website has support for.<\/p>\n\n\n\n<p>Before you change, remember to check that the PHP version you choose is compatible with the software that you are running, for example the version of WordPress or Joomla that you are using. Information about this is available from each developers&#8217; web site.<\/p>\n\n\n\n<p>It is possible at any time to change back to the version you used earlier if it turns out that your web site did not work after the change.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Which PHP versions are available?<\/h3>\n\n\n\n<p>On our webhosting services, Reseller Agency, and Managed Servers (running CloudLinux), you have access to the following PHP versions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>5.2<\/li>\n\n\n\n<li>5.3<\/li>\n\n\n\n<li>5.4<\/li>\n\n\n\n<li>5.5<\/li>\n\n\n\n<li>5.6<\/li>\n\n\n\n<li>7.0<\/li>\n\n\n\n<li>7.1<\/li>\n\n\n\n<li>7.2<\/li>\n\n\n\n<li>7.3<\/li>\n\n\n\n<li>7.4<\/li>\n\n\n\n<li>8.0<\/li>\n\n\n\n<li>8.1<\/li>\n\n\n\n<li>8.2<\/li>\n\n\n\n<li>8.3<\/li>\n\n\n\n<li>8.4<\/li>\n\n\n\n<li>8.5<\/li>\n<\/ul>\n\n\n\n<p>Each version is being held updated with bug fixes and security updates. Even the older versions that no longer are being supported by the PHP community receive security updates from us.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">Please note that if you have an non-managed VPS it is up to you to install and manage the PHP versions being available on the server.<br><br>If you run a server with cPanel, it is possible to buy CloudLinux as an addon, or you can use the built-in MultiPHP function.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Global version setting<\/h3>\n\n\n\n<p>After logging on to cPanel and accessing <code>Select PHP version<\/code> <a href=\"#access-to-the-settings\">according to the instructions above<\/a>, you can both see the currently active PHP version (marked <code>current<\/code>), and via the dropdown menu see the available PHP versions.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2020\/05\/cpanel_php-version_select.png\"><img loading=\"lazy\" decoding=\"async\" width=\"548\" height=\"508\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2020\/05\/cpanel_php-version_select.png\" alt=\"\" class=\"wp-image-10725\"\/><\/a><\/figure>\n\n\n\n<p>Select the version you like to run and click <code>Apply<\/code>. You are now using the selected version, but you may need to reload the page to see your newly selected version as the current one.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-version_apply.png\"><img loading=\"lazy\" decoding=\"async\" width=\"535\" height=\"65\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-version_apply.png\" alt=\"\" class=\"wp-image-24297\" srcset=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-version_apply.png 535w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-version_apply-300x36.png 300w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-version_apply-50x6.png 50w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-version_apply-60x7.png 60w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-version_apply-100x12.png 100w\" sizes=\"auto, (max-width: 535px) 100vw, 535px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Local version setting<\/h3>\n\n\n\n<p>You can set a specific PHP version for a single folder on you \naccount. This way you can run different versions of PHP for different \nparts of your account even though the global setting is set to another \nversion.<\/p>\n\n\n\n<p>To do this you have to edit the .htaccess-file that is in the folder \nfor which you want to set a PHP version for. If the .htaccess file does \nnot exist you can create it. You can do this using for example the <a href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-use-the-file-manager-in-cpanel\/\" target=\"_blank\" rel=\"noreferrer noopener\">File Manager<\/a> in cPanel (remember to activate viewing of hidden files if you are using the File Manager).<\/p>\n\n\n\n<p>When you have opened the <code>.htaccess<\/code> file for editing you will have to enter this code at the top of the file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">AddHandler application\/x-httpd-alt-php74___lsphp .php .php7 .phtml<\/pre>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">74 means PHP 7.4, replace it with the version you want to use, for example 56, 72, 84, and so on.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How do I managed PHP extensions?<\/h2>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">Please note that PHP extensions are managed per PHP version. If you manually activate a PHP extension for a certain version and then change the PHP version, you may need to activate the extension again for the new version.<\/p>\n\n\n\n<p>You can manage your PHP extensions from within cPanel. Some examples of PHP extensions are opcache, mysqli, imagick and soap.<\/p>\n\n\n\n<p>Begin with accessing cPanel -&gt; <code>Select PHP version<\/code> <a href=\"#access-to-the-settings\">according to the instructions above<\/a>.<\/p>\n\n\n\n<p>On the lower half of the page, you should see a large amount of checkboxes. Each one represents a different PHP extension. To activate it, you tick the box next to the extension name and to deactivate you untick it. Changes are saved automatically.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2018\/07\/PHP_module_select_en.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1580\" height=\"752\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2018\/07\/PHP_module_select_en.png\" alt=\"Select PHP modules\" class=\"wp-image-6729\"\/><\/a><\/figure>\n\n\n\n<p>When a change has been saved an infobox appears.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2018\/07\/PHP_module_successfully_saved_en-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"493\" height=\"99\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2018\/07\/PHP_module_successfully_saved_en-1.png\" alt=\"Change of PHP module saved\" class=\"wp-image-6733\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How do I manage PHP options?<\/h2>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">Please note that PHP options are managed per PHP version. If you manually adjust a PHP option for a certain version and then change the PHP version, you may need to make the same adjustment again for the new version.<\/p>\n\n\n\n<p>Sometimes you may want to adjust specific  settings for PHP, and on our servers this can be done in two ways; either via cPanel, or via a .user.ini file which you create on the account (on other servers this can be done via a php.ini file, but we do not use that system).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Via cPanel<\/h3>\n\n\n\n<p>After logging on to cPanel and accessing <code>Select PHP version<\/code> <a href=\"#access-to-the-settings\">according to the instructions above<\/a>, click the <code>Options<\/code> tab.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-options.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"592\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-options-1024x592.png\" alt=\"\" class=\"wp-image-25196\" srcset=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-options-1024x592.png 1024w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-options-300x173.png 300w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-options-768x444.png 768w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-options-50x29.png 50w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-options-60x35.png 60w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-options-100x58.png 100w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2019\/12\/cpanel_php-options.png 1166w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>There you may do your changes to the options by clicking on the values in the table. When you edit an option, the settings will save automatically.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/PHP_options_list.png\"><img loading=\"lazy\" decoding=\"async\" width=\"858\" height=\"896\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/PHP_options_list.png\" alt=\"Lista \u00f6ver PHP-inst\u00e4llningar\" class=\"wp-image-6687\"\/><\/a><\/figure>\n\n\n\n<p>When the value is saved, an infobox will be displayed in the top right corner.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/PHP_option_successfully_saved.png\"><img loading=\"lazy\" decoding=\"async\" width=\"482\" height=\"117\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2017\/01\/PHP_option_successfully_saved.png\" alt=\"PHP-inst\u00e4llning \u00e4ndrad\" class=\"wp-image-6689\"\/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Via .user.ini<\/h3>\n\n\n\n<p>You can also set PHP options via a <code>.user.ini<\/code> file on your webhosting account. Start with creating a file which you name <code>.user.ini<\/code> in the folder where the website is residing for which you wish to edit options. You may create the file with the <a rel=\"noreferrer noopener\" aria-label=\"File Managed (\u00f6ppnas i en ny flik)\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-use-the-file-manager-in-cpanel\/\" target=\"_blank\">File Manager<\/a> built into cPanel. Just remember to activate display of hidden files.<\/p>\n\n\n\n<p>Into the <code>.user.ini<\/code> file you may then put all PHP options you want to edit. The settings will act on the folder where the file is placed and all subdirectories. <em>E.g.<\/em> if you want to adjust the amount of memory each PHP process can access, you add this to the file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">memory_limit = 1024M<\/pre>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\"><strong>Settings you cannot set via .user.ini<\/strong><br><br>Not all PHP options are ajustable via .user.ini, you can find a list from php.net <a href=\"https:\/\/secure.php.net\/manual\/en\/ini.list.php\">here<\/a>. Only settings marked with changable: PHP_INI_ALL and PHP_INI_PREDIR is possible to set via <code>.user.ini<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using PHP via terminal\/SSH and cronjobs<\/h2>\n\n\n\n<p>If you want to run PHP commands or scripts via the <a href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-connect-to-my-web-hosting-account-using-ssh\/\" data-type=\"ht_kb\" data-id=\"4832\">terminal or SSH<\/a>, or via <a href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-set-up-cron-jobs\/\" data-type=\"ht_kb\" data-id=\"9393\">cronjobs<\/a>, you can enter the path to PHP in a few different ways.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using the global setting for PHP version<\/h3>\n\n\n\n<p>If you wish to run a PHP command or script using <a href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-manage-php\/#global-version-setting\" target=\"_blank\" rel=\"noreferrer noopener\">the PHP version globally set<\/a> for your web hosting account, enter the command in one of the following ways:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php \/home\/yourusername\/path_to_the_script.php<\/pre>\n\n\n\n<p>Or:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/usr\/local\/bin\/php \/home\/yourusername\/path_to_the_script.php<\/pre>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">If you want to access your PHP script via a <a href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-set-up-cron-jobs\/\" data-type=\"ht_kb\" data-id=\"9393\">cronjob<\/a>, you should use the latter version of the command.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using a specific version of PHP<\/h3>\n\n\n\n<p>If you on the other hand want to specify the PHP version for your PHP command or script, you need to run the command in the following manner instead:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/opt\/alt\/php73\/usr\/bin\/php \/home\/yourusername\/path_to_the_script.php<\/pre>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">By swapping out <code>73<\/code> in the command above you can determine what <a href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-manage-php\/#which-php-versions-are-available\" target=\"_blank\" rel=\"noreferrer noopener\">PHP version<\/a> to use. For instance, if you want to use PHP 7.0, change it to <code>70<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Via cPanel, you can manage a vast amount of settings for PHP; what version you use, which extensions that are active and which options should be used. In this guide, we will walk you through all of these. Access to the settings How do I change PHP version? Before you&#8230;<\/p>\n","protected":false},"author":12,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"ht-kb-category":[214],"ht-kb-tag":[],"class_list":["post-8338","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-cpanel-whm"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/8338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/comments?post=8338"}],"version-history":[{"count":39,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/8338\/revisions"}],"predecessor-version":[{"id":25198,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/8338\/revisions\/25198"}],"wp:attachment":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/media?parent=8338"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb-category?post=8338"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=8338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}