changing php.ini using ssh

Posted on 2012-03-23
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

torakeshb earned 2000 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: http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/PhpIni

Author Closing Comment

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

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

771 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