changing php.ini using ssh

Posted on 2012-03-23
1 Endorsement
Last Modified: 2012-03-23
I have a dedicated server with my host but when I try to upload a plugin or theme, I get this error:

The uploaded file exceeds the upload_max_filesize directive in php.ini.

Now, according to my host, I have to use ssh to edit the php.ini file.  I'm assuming by increasing that max filesize in that file, that error will go away.

I'm unfamiliar with using ssh but what I want to do is change the php.ini file in root so that all of my website accounts on my box have increased max file size.  I'm using cpanel so what are the steps to opening and editing that file.  I'm assuming I use vi to make changes?
Question by:COwebmaster
  • 2
  • 2

Accepted Solution

torakeshb earned 500 total points
ID: 37757781
1. ssh to the server using the command "ssh <ServerName>"
2. in the console provide the command "php -i | grep 'Configuration File'"
    Output would be : php -i | grep 'Configuration File'
<tr><td class="e">Configuration File (php.ini) Path </td><td class="v">/etc/php.ini </td></tr>
3) provide the command "vi /etc/php.ini" and enter (path of php.ini can be got from the previous command"
4) search the word upload_max_filesize by simply typing /upload_max_filesize and enter
5) use the arrow keys to reach the value mentioned
6) press i for inserting
7)  once you edit press escape
8) type ":wq"


1. ssh to the server using the command "ssh <ServerName>"
2. in the console provide the command "php -i | grep 'Configuration File'"
    Output would be : php -i | grep 'Configuration File'
<tr><td class="e">Configuration File (php.ini) Path </td><td class="v">/etc/php.ini </td></tr>
3) use winscp and connect to the server
4) browse through the navigation to reach "/etc/php.ini" (got from step 2)
5) double click open "/etc/php.ini" (got from step 2)
6) change the upload_max_filesize to your desired one
7) click save and close. (This will upload to the server by iteself)

Author Comment

ID: 37757897
Okay, I tried the first option using commands in putty. I made the change from 2M to 100M and tried to save it but it says it read only.  How do I change that in cpanel or in putty?

Expert Comment

ID: 37758057
The first one I mentioned is through putty.. open putty > type the server address > enter which will prompt for login screen

It seems your user account don't have privilege to change the settings.

For CPANEL refer this URL:

Author Closing Comment

ID: 37758287
I wasn't logged in as root before.  Works like a charm now, thanks!

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now