How to Edit PHP Settings in Apache on an Ubuntu 18.04 VPS or Dedicated Server

How to Edit PHP Settings in Apache on an Ubuntu 18.04 VPS or Dedicated Server

Posted on |

PHP settings are managed through a file called php.ini. Whenever the Apache webserver begins, the setup data is read. You must modify the ‘php.ini’ directory and start your web service to alter the standard PHP parameters. We will learn about how to edit PHP ini ubuntu

PHP defaults function well outside of the package, but modifying the configuration file lets you choose what actually works for you based on your equipment design and software development.

This post will teach you how to change the fundamental PHP parameters on your Apache web server operating on an Ubuntu 18.04 VPS and how to edit php ini ubuntu.


  • A VPS Service (for such finest VPS services, see HostAdvice’s VPS evaluations).
  • A non-root account having sudo access
  • Apache is a web server.
  • PHP

1st step: Decide where your php.ini folder is located.

You will have to update the important php.ini document from period to period. The computer files may differ somewhat based just on the PHP version installed on your system.

The file system may be found at:


For example, if you are using PHP 7.0, the script will be found at:


The same would be true for PHP 7.2. The file system may be found at:


Step 2: Access the PHP file type to make changes.

After you’ve determined the position of your document, you’ll need to modify it with a nano writer. To open a file, just use the following command:

$ sudo nano php_ini_file

Step 3: Modifying the php.ini file

As stated at the outset of this essay, the standard PHP parameters may be sufficient for the vast majority of websites or web apps. Nevertheless, depending on your situation, certain numbers may need to be adjusted slightly to guarantee that the website runs well.

In most circumstances, you will edit PHP ini ubuntu as shown below:

max execution time in PHP

This specifies the maximum execution duration in seconds that a PHP script can execute before being terminated.

You may have demanding scripts that need to execute for a few minutes and need to alter this setting. The default number is 30 seconds, or you may change it.

Default setting:

max_execution_time =30

Upload max filesize in PHP

This directive’s possible value is 2M. (two Megabytes). This value determines the maximum file size that may be uploaded using Php code. If you plan on uploading large files, you may need to alter this number.

For example, if you’re using phpMyAdmin to transfer a huge database, you’ll need to alter this number.

Default setting:


PHP post max size

This setting restricts the quantity of data that may be stored in post data. It typically affects Php code that employs a large number of online forms. Because the number also governs files submitted using a PHP script, it really should be greater than ‘upload max filesize’. The setting for ‘post max size’ is set to 8M by default.

Default setting:

post_max_size =8M

Memory limit in PHP

PHP 7.2’memory limit’ is set to 128M by default. Poorly written PHP scripts can consume a huge amount of memory management and interfere with other applications that run on your VPS. To prevent this, PHP’ memory limit’ helps to control how much memory is apportioned to a code.

Default setting

memory_limit = 128M

PHP Error Detection Preferences

You may alter the behaviour of errors in PHP by using the directives listed below:

display errors:> Based on whether you choose PHP to show mistakes when scripts are executed, change this option to ‘On’ or ‘Off.’ The default setting in PHP 7.2 is ‘Off.’

display_errors = Off

You may enable error alerting by setting the value to ‘On’:

display errors = On.

log errors: This score implies that script failures should be stored in the site’s log file. In a production environment, instead of showing faults to normal users, log them. In PHP 7.2, the possible value is ‘On.’

log errors = On

You may disable error recording by setting the value to:

You may disable error recording by setting the value to:

error reporting: This directive specifies the level of error reporting. The default setting for PHP editions older than 5.3 is ‘E ALL & E DEPRECATED & E STRICT’.

E ALL & E DEPRECATED & E STRICT = error reporting

You can alter the value based on the faults you wish to be reported. For example, to include notifications, use the value beneath.

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE

PHP Date/Time Configuration

You may also modify the timezone that PHP programmes use by convention.

Find the following row:


Remove the semicolon to uncomment it, and afterwards input your selected time zone. The official PHP site ( has a list of support time frames.

For example, if you want to improve the local time to New York City, enter the following value:

date.timezone= “America/New_York”


This post has shown you how to identify and modify PHP parameters on your Ubuntu 18.04 server. We’ve also gone through the fundamental parameters you should change to improve the performance of your website or online applications. We think that the adjustments you apply to your PHP config file will assist you to operate your websites more smoothly. So that is how you can how to edit PHP ini ubuntu.


DataServerMarket can help you find internet connectivity for any IT issues. DataServerMarket develops shared facilities for a diverse range of consumers to utilise on-site.

The following are among some of the programs provided by DataServerMarket:

  • DataServerMarket joins several databases and memory management locations that are concurrent.
  • DataServerMarket offers data and processed connection options to businesses.
  • Furthermore, DataServerMarket offers qualified professional help, and also electronic adaptability and integrated systems.
  • DataServerMarket also offers cloud teleconferencing, global communications technology, and IP connection between clients and Service Providers.
  • DataServerMarket provides services such as storing, VPN connections, personal email account address options, relocation, and data transmission.

DataServerMarket develops shared rooms that may be used by a range of users on-site. DataServerMarket connects several databases and centralized data sources for faster communication. Users and Network Operators may also get cloud video, global telecom services, and IP connections from DataServerMarket. Storage, Vpn Clouds, independent email, transfer, and data exchange services are all available from DataServerMarket.

Leave a Reply

Your email address will not be published. Required fields are marked *