Changing PHP version and settings
To change the PHP version, go to the Plesk control panel. Select the website for which you want to change the PHP version and click on the "PHP" section.
To change the PHP version, open the dropdown menu and select the desired version. You can also adjust individual settings. Let's break down what each setting is responsible for:
`memory_limit` controls the maximum amount of memory that a single PHP process can use when executing a script. If a script tries to consume more memory than specified in this setting, it will be terminated, and PHP will throw an error. This allows controlling the memory consumption of scripts and preventing situations where scripts use excessive resources, which could lead to server overload or decreased performance.
`max_execution_time` defines the maximum time, in seconds, that a PHP script is allowed to execute before it is terminated. If a script exceeds this time limit, PHP will stop its execution and throw an error. This setting helps prevent scripts from running indefinitely, ensuring that server resources are not tied up by long-running processes.
`max_input_time` defines the maximum time, in seconds, during which PHP should accept input from the client, such as POST form data or file uploads. If the input is not completed within this time, PHP terminates script execution and throws an error. This setting helps prevent scripts from getting stuck due to prolonged waiting for input from the client.
`post_max_size` defines the maximum amount of data that can be sent via the POST method in PHP. This includes form data, uploaded files, and other data sent via POST requests. If the size of the sent data exceeds the set `post_max_size` value, PHP will truncate the data and may also throw an error. This setting helps prevent sending overly large requests that could lead to server overload.
`upload_max_filesize` defines the maximum size of a file that can be uploaded to the server via PHP. If the size of the uploaded file exceeds the value set in `upload_max_filesize`, PHP terminates the upload process and may throw an error. This setting helps control the sizes of uploaded files and prevents the upload of excessively large files, which could adversely affect server performance.
`opcache.enable` determines whether OPCache is enabled or not. OPCache is a PHP code optimization and caching module that speeds up PHP script execution. When `opcache.enable` is set to "1" (enabled), OPCache is activated, and PHP scripts are cached for reuse, enhancing performance. If set to "0" (disabled), OPCache is turned off, and PHP scripts are not cached. Typically, OPCache is enabled in production environments to improve PHP performance.
`disable_functions` defines a list of PHP functions that will be prohibited from use in scripts. When a function is listed in this directive, it will be unavailable for invocation from PHP scripts on the server. This allows server administrators to restrict dangerous or unwanted functions to enhance security and prevent abuse. For instance, functions like `exec()` or `system()` might be disabled to prevent the execution of malicious commands on the server.
`include_path` defines a list of directories where PHP will look for files to include using `include` and `require` statements. If a file cannot be found in the current script directory, PHP will search for it in each directory listed in the `include_path`. This allows specifying to PHP where to look for user libraries, classes, or other files required for the application to function.
`session.save_path` specifies the directory path where PHP saves session data on the server. PHP uses sessions to store information about a user's state between requests. When a user logs in or performs other actions related to the session, data is saved on the server for subsequent access. By specifying the path in `session.save_path`, you can control the location where session data is stored on the server.
`mail.force_extra_parameters` allows specifying additional parameters to be passed when invoking the email sending function in PHP, such as `mail()`. These extra parameters may include message headers or other parameters needed during the email sending process. This can be useful, for example, for setting additional headers or SMTP server parameters when sending emails from PHP scripts.
`open_basedir` is a configuration directive in PHP that restricts PHP scripts' access to the file system. When `open_basedir` is set, PHP considers only those files located in the specified directories or their subdirectories as permissible. This is a security measure aimed at preventing PHP scripts from accessing sensitive or unwanted files outside the specified directories.
`error_reporting` defines the level of error messages that will be displayed or logged in the PHP error log. This directive allows controlling which types of errors will be displayed or logged and to what extent they will affect script execution. Error levels can include warnings, notices, fatal errors, and other types of messages. For example, setting `error_reporting` to `E_ALL` enables displaying all types of errors, including warnings, notices, and fatal errors.
`display_errors` is a configuration directive in PHP that determines whether error information occurring in PHP scripts will be displayed directly on the user's screen or web browser. If the value of `display_errors` is set to `On`, PHP will display errors on the screen along with other page content. This can be helpful during development when you need to quickly detect and fix errors. However, in a production environment, it is recommended to set `display_errors` to `Off` to avoid inadvertently displaying error information to the user, which can pose a security risk or lead to leakage of confidential information. Instead, it is recommended to configure error logging in the PHP error log using the `log_errors` directive so that administrators can view and analyze errors without publicly displaying them on the screen.
`log_errors` is a configuration directive in PHP that controls the logging of error information to a special error log on the server. When `log_errors` is set to `On`, PHP will write error information such as warnings, notices, and fatal errors to the server's error log. This log can then be viewed by server administrators to detect, analyze, and address errors. Setting `log_errors` to `Off` means that PHP will not write error information to the log, which can be useful in some situations where you want to manage error logging manually or when error logging is not required due to the nature of the application. Together with `display_errors`, which determines whether error information will be displayed on the user's screen, `log_errors` helps server administrators effectively manage and analyze errors occurring in PHP scripts.
`allow_url_fopen` is a configuration directive in PHP that determines whether opening remote files and URLs using input/output functions in PHP, such as `fopen()`, `file_get_contents()`, and others, is allowed. If `allow_url_fopen` is set to `On`, PHP will allow opening remote files and URLs, which can be useful for working with external resources such as APIs or remote files. However, this can also pose a security risk, as opening remote files can be exploited by attackers for executing attacks or accessing others' data.
`file_uploads` is a configuration directive in PHP that determines whether file uploads to the server via HTTP requests using the `<input type="file">` form control are allowed. If `file_uploads` is set to `On`, file uploads are permitted; if set to `Off`, file uploads are disallowed. This allows server administrators to control the ability to upload files to the server and prevent the upload of unwanted or malicious files.
`short_open_tag` is a configuration directive in PHP that determines whether the use of the short syntax `<? ?>` for the opening PHP tag is allowed. If `short_open_tag` is set to `On`, the short syntax for the opening PHP tag will be allowed. If set to `Off`, the short syntax will not work, and only the full syntax `<?php ?>` will be used. This can be useful for compatibility with various server configurations and ensuring clearer separation of PHP code from the rest of HTML.
`pm.max_children` is a configuration parameter in PHP-FPM that defines the maximum number of PHP-FPM child processes that can simultaneously handle requests. Each PHP-FPM child process can handle one request at a time. Setting the value of `pm.max_children` allows controlling the number of concurrently running PHP-FPM processes and overall server resource usage.
`pm.max_requests` is a configuration parameter in PHP-FPM that defines the maximum number of requests a single PHP-FPM child process can handle before it gets restarted. After processing the specified number of requests, the child process will be restarted to prevent memory leaks and ensure stability. Setting the value of `pm.max_requests` allows controlling the lifecycle of PHP-FPM child processes.
`pm` parameter is responsible for selecting the process manager mode. This parameter determines how PHP-FPM manages its child processes, which handle requests to execute PHP scripts.
- Static: In this mode, PHP-FPM creates a fixed number of child processes specified in the `pm.max_children` directive. These processes remain active regardless of the number of incoming requests.
- Dynamic: In dynamic mode, PHP-FPM dynamically adjusts the number of child processes based on the workload. The number of active child processes is controlled by the `pm.max_children`, `pm.start_servers`, `pm.min_spare_servers`, and `pm.max_spare_servers` directives.
- OnDemand: In ondemand mode, PHP-FPM creates child processes only when there are incoming requests. The number of active child processes increases or decreases based on the workload and is controlled by the `pm.max_children`, `pm.process_idle_timeout`, and `pm.max_requests` directives.
Each process manager mode has its own advantages and characteristics, and the choice depends on factors such as server resources, expected workload, and performance requirements.
`pm.start_servers` is a configuration parameter in PHP-FPM that specifies the initial number of child processes to be created when PHP-FPM starts. These child processes will be ready to handle incoming requests immediately after PHP-FPM starts. This parameter allows setting the initial number of active processes for quick response to incoming traffic.
`pm.min_spare_servers` is a configuration parameter in PHP-FPM that specifies the minimum number of idle child processes that should remain active to ensure continuous handling of incoming requests. If the number of active processes falls below the set value, PHP-FPM creates new processes to maintain the specified minimum number of active processes.
`pm.max_spare_servers` is a configuration parameter in PHP-FPM that specifies the maximum number of idle child processes that can remain inactive to provide scalability flexibility based on the load. If the number of idle processes exceeds the set value, excess processes will be terminated to avoid overloading the server with resources.
After selecting, press "OK".