Verification: a143cc29221c9be0

No php ini file will be used

No php ini file will be used

.user.ini

On the WordPress Hosting service, php directives would need to be adjusted within the .user.ini file. Note, this is different from the typical php.ini file seen in most of (mt) Media Temple servers. If this is the first time you are trying to modify these limits, you will need to create a file named ".user.ini" within the document rootdocument root or ".../html" directory using the File Manager, FTP or SSH.

PHP directives

Once the .user.ini file is created within ".../html" you may input your desired php directives. We recommend checking out our additional articles on php limits before saving any changes:

  • How do I increase the PHP upload limits?
  • CGI and PHP resource limits

Overview

The php.ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits.

The most common parameters changed in the php.ini file are:


safe_mode
register_globals
upload_max_filesize
post_max_size
max_execution_time

Additional directives can be found here.

If you're experiencing difficulty with your web application, you can edit the sample "php.ini.sample"php.ini or create a new text file. For example, you're unable to install a WordPress theme or plugin through your WP Dashboard.

Before making any changes, it's a good idea to copy the original settings, both for reference and to easily restore the original if necessary.

READ ME FIRST

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is unsupported by (mt) Media Temple. Please take a moment to review the Statement of Support.

Via AccountCenter

As a Grid user, your easiest option would be to use the File Manager to make the changes. Here's how:

  • Log into the AccountCenter
  • Click the Admin button to the right of your primary domain
  • Select File Manager
  • Click on the /etc folder

Inside the /etc folder, you'll see the php.ini.sample file. When you click on the Edit button, you'll see the below window. Just rename the filename to php.ini and add whatever parameters you need.

g-1.png

After you make your edits, click SAVE CHANGES. Your changes will be saved and should take effect right away.

Via SSH

An alternate way to edit your php.ini file would be to connect via SSH as the Server Administrator.

Change directory to the etc folder using this command:

cd ~/../../etc

Use the following command to start editing:

vi php.ini

Via FTP

You can download the file locally and edit. This requires familiarity with Using FTP and SFTP and a plain text editor.

FAQs

Do I need to restart my service for the changes to take effect?

No, in fact there is no way or need for customers to restart services on the Grid. Any changes you make within your php.ini will be effective within a few moments.

Is there any way to use a different php.ini in each domain/folder on the Grid?

Not with a php.ini. The php.ini is designed to set global settings for your account. You can make changes on a per domain basis via a .htaccess file. More info on this can be found at http://www.askapache.com/htaccess/php-htaccess-tips-and-tricks.html.

Overview

The php.ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits.

The most common parameters changed in the php.ini file are:


safe_mode
register_globals
upload_max_filesize
post_max_size
max_execution_time

Additional directives can be found here.

If you're experiencing difficulty with your web application, you can edit the sample "php.ini.sample"php.ini or create a new text file. For example, you're unable to install a WordPress theme or plugin through your WP Dashboard.

Before making any changes, it's a good idea to copy the original settings, both for reference and to easily restore the original if necessary.

READ ME FIRST

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is unsupported by (mt) Media Temple. Please take a moment to review the Statement of Support.

Requirements

Before you start, you'll need:

  • Root access enabled.
  • To know how to connect to your DV via SSH.

Method 1

One way to find out exactly which php.ini file your web sever is using is by creating a new PHP file in document root called info.php.

info.php

Load this file in your browser, press CTRL + F (or Command + F on Mac) and search for “Loaded Configuration File”. You should see something like

/etc/php/7.4/apache2/php.ini

This will tell you the exact location of the php.ini file you want to edit.

Method 2

In Linux, run this command to locate the PHP.ini configuration file.

php -i | grep "Loaded Configuration File"

Or in Windows Command Line:

php -i | findstr /c:"Loaded Configuration File"

The result should be something like this.

Loaded Configuration File => /etc/php/7.4/cli/php.ini

In the above example, we can see that the PHP install is located in /etc/php/7.4. Note that there are three different configuration files you should we aware of:

CLI

/etc/php/7.4/cli/php.ini is for the CLI PHP program. Changes to this config file will only affect PHP as it runs in the terminal – it will NOT affect the web server.

Apache

/etc/php/7.4/apache2/php.ini is for the PHP plugin used by Apache. This is the one you need to edit if you are using the Apache web server.

Nginx or Apache with PHP-FPM

/etc/php/7.4/fpm/php.ini is a fastcgi-compatible ‘wrapper’ for PHP processing. This is the one you need to edit if you’re using the Nginx web server or Apache with PHP-FPM.

Method 3

Using the locate command in Linux,. If it’s not already installed, run  sudo apt update && sudo apt install mlocate.

locate php.ini

You should see a list of php.ini files here. Try editing one of them and restarting you web server to see if makes the required changes.

Editing php.ini in Linux

Apache

On Apache, php.ini is usually located in /etc/php/7.4/apache2/php.ini. Replace 7.4 with your own version, e.g, php5.6php7.1, etc.

To edit:

sudo nano /etc/php/7.4/apache2/php.ini

However, if you are using PHP FPM, it may be located in /etc/php/7.4/fpm/php.ini. Replace 7.4 with your own version, e.g, php5.6php7.1, etc.

To edit:

sudo nano /etc/php/7.4/fpm/php.ini

To save file and exit, press CTRL + X, press Y and then press ENTER

You must restart Apache after altering php.ini.

sudo systemctl restart apache2

If you are using PHP-FPM, you must restart that service. Replace php7.4 with your own version, e.g, php5.6php7.1, etc.

sudo service php7.4-fpm restart

Nginx or Apache with PHP-FPM

Nginx uses PHP FPM and php.ini is usually located in /etc/php/7.4/fpm/php.ini. Replace 7.4 with your own version, e.g, php5.6php7.2, etc.

sudo nano /etc/php/7.4/fpm/php.ini

To save file and exit, press CTRL + X, press Y and then press ENTER

You must restart Nginx after altering php.ini.

sudo service nginx restart

Method 1

One way to find out exactly which php.ini file your web sever is using is by creating a new PHP file in document root called info.php.

info.php

Load this file in your browser, press CTRL + F (or Command + F on Mac) and search for “Loaded Configuration File”. You should see something like

/etc/php/7.4/apache2/php.ini

This will tell you the exact location of the php.ini file you want to edit.

Method 2

In Linux, run this command to locate the PHP.ini configuration file.

php -i | grep "Loaded Configuration File"

Or in Windows Command Line:

php -i | findstr /c:"Loaded Configuration File"

The result should be something like this.

Loaded Configuration File => /etc/php/7.4/cli/php.ini

In the above example, we can see that the PHP install is located in /etc/php/7.4. Note that there are three different configuration files you should we aware of:

CLI

/etc/php/7.4/cli/php.ini is for the CLI PHP program. Changes to this config file will only affect PHP as it runs in the terminal – it will NOT affect the web server.

Apache

/etc/php/7.4/apache2/php.ini is for the PHP plugin used by Apache. This is the one you need to edit if you are using the Apache web server.

Nginx or Apache with PHP-FPM

/etc/php/7.4/fpm/php.ini is a fastcgi-compatible ‘wrapper’ for PHP processing. This is the one you need to edit if you’re using the Nginx web server or Apache with PHP-FPM.

Method 3

Using the locate command in Linux,. If it’s not already installed, run  sudo apt update && sudo apt install mlocate.

locate php.ini

You should see a list of php.ini files here. Try editing one of them and restarting you web server to see if makes the required changes.

Editing php.ini in Linux

Apache

On Apache, php.ini is usually located in /etc/php/7.4/apache2/php.ini. Replace 7.4 with your own version, e.g, php5.6php7.1, etc.

To edit:

sudo nano /etc/php/7.4/apache2/php.ini

However, if you are using PHP FPM, it may be located in /etc/php/7.4/fpm/php.ini. Replace 7.4 with your own version, e.g, php5.6php7.1, etc.

To edit:

sudo nano /etc/php/7.4/fpm/php.ini

To save file and exit, press CTRL + X, press Y and then press ENTER

You must restart Apache after altering php.ini.

sudo systemctl restart apache2

If you are using PHP-FPM, you must restart that service. Replace php7.4 with your own version, e.g, php5.6php7.1, etc.

sudo service php7.4-fpm restart

Nginx or Apache with PHP-FPM

Nginx uses PHP FPM and php.ini is usually located in /etc/php/7.4/fpm/php.ini. Replace 7.4 with your own version, e.g, php5.6php7.2, etc.

sudo nano /etc/php/7.4/fpm/php.ini

To save file and exit, press CTRL + X, press Y and then press ENTER

You must restart Nginx after altering php.ini.

sudo service nginx restart