Support / KnowledgeBase

 
Search the KnowledgeBase Search

How can I edit the php.ini file?

  • Applies to: All DV, Grid

  • Difficulty: Medium

  • Time needed: 10 minutes

  • Tools needed: SSH, root or sudo access; AccountCenter access, SSH enabled, FTP client, plain text editor

 
  • Applies to: Grid
    • Difficulty: Medium
    • Time Needed: 20
    • Tools Required: AccountCenter access, SSH enabled, FTP client, plain text editor
  • Applies to: DV
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Plesk or SSH access

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. Additional directives can be found here.

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.

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.

If you're exeriencing 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.

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 ( edit icon the gears icon to the far right), you'll see the below window. Just remove the ".sample" from the filename and add whatever parameters you need to add.

Sample php.ini

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


safe_mode
register_globals
upload_max_filesize
post_max_size
max_execution_time

After you make your edits, click OK. 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.

Requirements

Before you start, you'll need:

Instructions

Global php.ini

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


safe_mode
register_globals
upload_max_filesize
post_max_size
max_execution_time

Use the following command at the command prompt to start editing the global php.ini file:

vi /etc/php.ini

When you are finished editing your php.ini, you will need to restart your apache server. Run the following command:

/etc/init.d/httpd restart

 

Domain-specific php.ini

Plesk 11.0 and later features a domain-specific php.ini file. This domain-level version of php.ini overrides the global php.ini settings. There are two main ways to edit this file.

via Plesk

You can edit the domain-level php.ini file through the Plesk Control Panel.

1. Select the Websites & Domains tab.

137_1 

2. Expand the advanced options by clicking the arrow, as shown below:

137_2 

3. Select PHP Settings from the menu.

137_3 

4. Most common PHP directives are in this page and ready for you to modify. You can select common options from the drop-down menus, or create your own by using the "Custom Variable" option. For directives that are not listed, raw text can be input in the box at the bottom of this screen.

5. Click "OK" at the bottom to save.

Important Note
If you choose to use the Plesk "PHP Settings" menu to edit php.ini, it will overwrite any manual changes you have made to /var/www/vhosts/DOMAIN/etc/php.ini via SSH or FTP.

via SSH

You'll first need to log in via SSH.

Use the following command to start editing the domain-level php.ini:

                vim /var/www/vhosts/DOMAIN/etc/php.ini

Be sure to replace DOMAIN with the domain name you want to edit.

Resources

 

Continue