How to Use PHP Selector in Plesk

WordPress and other PHP programs communicate with the server and run scripts using PHP Extensions. Sometimes WordPress  and some other scripts will fail to run or cause errors  because the required extensions are not enabled. 

This article will help you fix that.

To start, log into your Plesk account. As shown below, go to the PHP Selector dashboard.

Plesk php selector

The dashboard will open up to the extensions page, where you can;

1. Selecting a specific website (if you have more than one domain in the same subscription) 

2. change the PHP version to the options available on the server.

3. Reset the default PHP settings as per the preset server settings.

4. Enable or disable PHP extensions as required. 

Selecting a specific website to change PHP settings for. #

If you have more than one website on your Plesk account then in order to change the PHP section of a specific website under the same subscription, please follow the following. 

 

– Hover your mouse on the domain name you want to change php settings for as per the image below untill a link icon shows up as directed by the image below and click on it. 

When you click on the link icon as per the image above it will take you to a page where you can manage settings only for that specific website then you can click on php selector as per the image below. 

From there you will be taken to a page where you can change the php settings of that specific website, make sure the right website is selected as per the image below and then you can proceed. 

Changing your php version.  #

If you want to change the php version, please click on the facing down blue arrow as per the image above, then select the php version you want as per the picture below. 

After you have selected the php version you want, click on “set as current” to activate your new php version as per the picture below.  

save new php version

Changing PHP Extentions #

After you have selected the php version you want you can now choose the PHP extensions you need , a list of PHP extensions can and their use can be found On this LINK. 

 

If you are using WordPress the basic PHP extensions you need are the following 

  • APCu
  • Dom
  • dBase
  • fileinfo
  • Exif
  • Gmagic or Imagick
  • IMAP
  • json 
  • mbstring
  • mysqli
  • pcre
  • sodium
  • xml
  • zip
php selector options

Some themes and plugins will require other extensions from the basics and you can enable these as required. 

Changing PHP options and limits #

If you need to change the php options and limits you can do so by clicking on the options button as per the picture below. 

When the allow_url_fopen directive is enabled, you can write scripts that open remote files as if they are local files. For example, you can use the file_get_contents function to retrieve the contents of a web page.

The allow_url_fopen directive is disabled by default. You should be aware of the security implications of enabling the allow_url_fopen directive. PHP scripts that can access remote files are potentially vulnerable to arbitrary code injection.

The display_error setting in PHP is used to determine whether errors should be printed to the screen or not. The error can be used as a part of the output or can be hidden from the user. 

Use this when your site is not working correct or throwing errors with numbers and you want to see where the actual error is. 

The error_reporting — Sets which PHP errors are reported , you can choose to display all of them or just warnings and suggestions. 

Will allow you to upload files via http

This is the list of directories where scripts look for files (similar to the system’s path variable) . To separate directories, use a colon. 

Tells the system whether or not to log errors. Use with caution, if your system is buddy the file can get quite big. 

Additional parameters for the mail() function used to send mail.

This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from using up all the resources in the server.  

This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. Timing begins at the moment PHP is invoked at the server and ends when execution begins. The default setting is -1, which means that max_execution_time is used instead. 

This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server..

It is a restriction to prevent a hosting package user from accessing any paths on the server that are not authorised, such as the paths to other domains on shared web servers, or to access the hosting software.

The open_basedir function defines the locations or paths from which PHP is allowed to access files using functions like fopen() and gzopen(). If a file is outside of the paths defined by open_basedir, PHP will refuse to open it.

This is the maximum size in bytes that can be posted with the POST method. Typically should not be larger that the upload_max_filezise