After you deploy a web application on a Linux-based Web Hosting instance, you may need to configure PHP environment parameters or enable specific functions. This ensures that your scripts and website modules run correctly and helps improve security. For example, enabling the PHP function chmod affects file permissions.
Parameters
You can configure php.ini parameters only on Linux-based Web Hosting instances. Log on to the Cloud Web Hosting management page and go to the page. On this page, you can view and modify PHP environment parameters and functions.
By default, some PHP functions are disabled on Web Hosting instances to prevent exploitation by attackers, which can cause poor website performance. We recommend that you consult your website provider before you enable these functions. After you finish using a function, disable it promptly.
The following table describes the php.ini environment parameters and functions.
|
Parameter |
Description |
|
error_log |
By default, this feature is Disabled. When enabled, it sends error messages to the error logs in the wwwlogs directory of your Web Hosting instance. |
|
output_buffering |
Disabled by default. When enabled, this setting turns on output buffering, storing PHP output in a memory buffer instead of sending it to the browser immediately. |
|
file_uploads |
The status is Enabled by default, which allows you to upload website files to the host. |
|
chown |
This is Disabled by default. You can enable it to change the owner of specified files. |
|
chmod |
By default, this function is Disabled. After you enable it, you can change the read, write, and execute permissions of a specified file. Important
The Disabled state may affect the installation and use of plugins and themes for software such as WordPress. We recommend that you enable this function as needed. |
|
fsockopen |
The default state is Enabled, which allows you to open a network connection or a Unix socket connection. |
|
request_order |
The default value is GP. This parameter defines the order in which request variables are parsed. |
|
upload_max_filesize (MB) |
The default value is 10. You can set this to an integer from 1 to 200. This parameter sets the maximum size for a single uploaded file. This parameter is available only when file_uploads is enabled. Note
If you enter an integer greater than 200, such as 300, the system automatically caps the value at 200. |
Procedure
- Log on to the Cloud Web Hosting management page.
- Find the Cloud Web Hosting instance that you want to manage and click Manage in the Actions column.
- In the navigation pane on the left, choose .
-
On the PHP.ini Settings page, configure the parameters or functions as needed.
The following sections provide examples of setting the file upload size limit and enabling the
chownandchmodfunctions. You can follow similar steps to configure other parameters, such as the error log parameter.Set the file upload size limit
ImportantTo enhance security, Linux-based Web Hosting instances limit the size of uploaded files to a maximum of 200 MB.
-
In the PHP Parameters section, set the file upload control to Enable.
-
In the PHP Function Settings section, enter a value for upload_max_filesize (MB).
-
Click Save Settings.
-
In the Prompt dialog box, click OK.
A confirmation message appears at the top of the page.
Enable the chown and chmod functions
To ensure website security, the
chownandchmodPHP functions are disabled by default on Linux-based Web Hosting instances. If you need to change file ownership or permissions, you must enable thechownandchmodfunctions.-
In the PHP Function Settings section, set both PHP function chown setting and PHP function chmod setting to Enable.
WarningEnabling the
chownandchmodfunctions makes your website more vulnerable to attacks that can cause slow performance or access issues. Consult your website provider before you proceed. When you no longer need these functions, disable thechownandchmodfunctions. -
Click Save Settings.
-
In the Prompt dialog box, click OK.
A confirmation message appears at the top of the page.
-
Related documents
-
If your web application version is incompatible with the PHP version of your instance, your website may fail to run. You can change the PHP version to meet your application requirements. For more information, see Change the PHP version.
-
The default PHP extensions and settings vary slightly across different PHP versions on Linux-based Web Hosting instances. For example, the
short_open_tagsetting is enabled by default in all supported versions, while theZend OptimizerPHP extension is enabled by default only in PHP 5.2. For more information, see Default PHP extensions for Linux-based Web Hosting instances.