Sun

Configure PHP settings

  1. Home
  2. Knowledge Base
  3. Configure PHP settings

Certain PHP settings can be tailored to your needs. You can use a .user.ini file to configure PHP settings, such as the amount of data that can be uploaded, displaying errors, increasing memory limits and so on.
This tutorial covers information for configuring your PHP environment using .user.ini file. This file should be hosted in public_html folder of your website. If you don’t have one, you can create it yourself.

Memory Limit

This sets the maximum amount of memory in bytes that a script is allowed to allocate. The value should be created like this:

memory_limit=256M

Max Upload Size

The maximum size of an uploaded file, this may be required if you want to upload larger images or attachments.

upload_max_filesize=50M

Max Execution Time

This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.

max_execution_time=120

Max Input Time

This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET.

max_input_time=120

Max Post Size

Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize.

post_max_size=256M

PHP Error Debugging

PHP provides useful and descriptive error messages when things go awry. But it doesn’t show all these errors when running using its default configuration. This makes sense to not let the users seeing PHP specific error messages, but it also makes everything that much more confusing for debugging the script. You can enable error reporting by using these values:

; Example Settings
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = On
display_startup_errors = On

Was this article helpful?