Modify php.ini through SSH for Plesk
I recently ordered a VPS and began to customize it. Unfortunately, I'm not a linux expert (or geek for that matter) so some of what I needed to do didn't come natural to me.
Like altering the php.ini file. Through SSH command line. Thingy.
But through the power of Google and my sheer determination to do this myself, I managed to increase my VPS' memory limit! (Drupal just won't work well at 8M.) And here's how I did it.
(Some notes: I did this through Apple's Terminal utility, logged into ssh mode to my server as root. Plesk keeps the php.ini file in the /etc/ folder, and nano wouldn't work, so I used vi )
First, I typed this is:
cd /etc/
Then I opened up the vi editor with:
vi php.ini
At this point you're seeing half a screen of text (the top of the php.ini file.) You MUST read the Basic vi Commands Page if you don't know what you're doing. I actually found it to be extremely helpful and not too intimidating after a bit of practice. Command b and Command f will go through the pages, and the other commands are pretty intuitive.
Follow the instructions from the Basic vi Commands webpage to alter the php.ini file. (Read the sections on deleting and changing text.)
When you've made the changes type in
:w < Hit Return >
to save (write) the changes then
:q < Hit Return >
to quit.
Restart Apache
service httpd restart
and your changes should be live.
I know, this stuff is pretty basic for a lot of people, but I was just thrilled I did it! And if I can do it... well...
Sources:
I discovered the two lines to get into vi here.
The Basic vi Commands.
Restart Apache.

Comments
Magpie Coffeehouse (not verified)
16 February 2008 - 6:39am
Permalink
Sounds complex!
Sounds complex!
david
16 February 2008 - 11:17am
Permalink
no
not really. Just takes a few minutes of getting the hand of navigating through the page. One you learn the keyboard commands (and page down to where you want to go) it's pretty easy.
Demy (not verified)
28 June 2008 - 4:32am
Permalink
Thanks!
Thank you David!
With few simple lines and a couple of links, you saved me!
Jamie Le Souef (not verified)
21 July 2008 - 7:50pm
Permalink
Nano
Hi,
If you are wanting to use nano, type
yum install nano(if you are using CentOS or something like that) or
apt-get install nano(if you are using Debian based OS)
That'll install nano for you and make life much easier
Anonymous (not verified)
9 December 2008 - 8:22am
Permalink
Same with cPanel
my server runs cPanel...should it be the same?
When I go to my /etc folder, there is no php.ini file there....should there be?
david
9 December 2008 - 10:16am
Permalink
I don't think so. cPanel
I don't think so. cPanel and Plesk use different structures. Maybe in the /conf/ file ?
Anonymous (not verified)
30 December 2008 - 6:21pm
Permalink
with cPanel it will be in
with cPanel it will be in /usr/local/lib/php.ini
so if you wanted to edit:
yum install nano ( say yes if prompted )
nano -w /usr/local/lib/php.ini
ctrl+x to save
Felix (not verified)
27 March 2009 - 9:09am
Permalink
oha
Sound really complex
david
15 April 2009 - 10:19am
Permalink
complex...
it is complex. But doable with a little thinking.
Picchio (not verified)
6 August 2009 - 6:00am
Permalink
Very helpful! thx
Very helpful! thx
fax from computer (not verified)
30 October 2009 - 1:06pm
Permalink
Drupal
I have thought about moving to drupal but I am not very computer literate. So it looks very complicated.
Clyde (not verified)
16 November 2009 - 2:02am
Permalink
Thanks
Thank for this - the whole modification of php.ini process was completely scary and very cool.
Change of Address (not verified)
25 November 2009 - 6:12am
Permalink
Congratulations!
I congratulate you for creating this! As a fellow linux "non-expert," I recognize how scary changing some of these things can be. My hat is off to you for trying, succeeding, and sharing!
Moving (not verified)
25 November 2009 - 6:23am
Permalink
Moving any files?
Did this require moving any other files, or was it just editing this one? One suggestion I would offer is to keep two subdirectories: \test and \master. I put draft scripts in \test, and the last version that worked in \master. That way I can keep my test scripts from getting confused with live versions, and keep a backup of the last script that worked in case I mess something up and need to restore the last master.
bukmacher (not verified)
30 November 2009 - 6:02am
Permalink
changing php.ini through
changing php.ini through command line is very difficult to me too, i had many problems but finally i have success, lesson learned
Wilbert (not verified)
4 December 2009 - 9:09am
Permalink
Yes, changing php.ini is
Yes, changing php.ini is indeed a hassle when done through command line. I tried Movings's suggestion to to keep the two sub-directories and worked ok.
christophe (not verified)
28 December 2009 - 12:04pm
Permalink
changing is ok
Tnaks for that article. I changed this file with no difficult.
PotBelly pigs (not verified)
28 December 2009 - 4:54pm
Permalink
thanks
thanks for this guide , its very helpfull.
Kojak (not verified)
28 December 2009 - 6:44pm
Permalink
Exactly
Thanks for this. this is exactly what i am looking for!
google sniper review (not verified)
29 December 2009 - 4:51am
Permalink
Thank you!
Hello, thanks for this guide, just what I needed to modify the php.ini!
Film gratis (not verified)
29 December 2009 - 7:46am
Permalink
Thanks!
Thanks, you saved my ass today.
I've got a vps at linode and they are meant for true geeks eheh
Feuerspucker (not verified)
30 December 2009 - 12:46pm
Permalink
Thank you
Great thanks und a happy new year - Good Tip - very nice!
Kinder (not verified)
31 December 2009 - 7:39am
Permalink
Easier?
Is there not a newer editor as vi? Someone told me something about vi+, could it be? By the way: I use WinSCP to edit configuration files. Thanks for your post.
Sondora@aionfr (not verified)
1 January 2010 - 10:52am
Permalink
Whoaw
Will try it out but don't think I will be able to do this
Indonesia Java ... (not verified)
6 January 2010 - 10:51am
Permalink
Party 2010
thank you for the advice in this post I really like the tutorial you
may be able to add my knowledge
I'm trying to let alone in the international destination java Indonesia
Jon (not verified)
8 January 2010 - 4:11pm
Permalink
it sounds like something i
it sounds like something i would definately mess uo trying to do,
antike bilderrahmen (not verified)
10 January 2010 - 5:41pm
Permalink
dude
this was a good read. sounds a bit complex to me (noob) but i learned something today from you. thanks a lot for the share! cheers
Mr.Doors (not verified)
17 January 2010 - 12:42am
Permalink
Thank..
Thank for sharing. My site error about php.ini.
Thank so much.
Kneipp (not verified)
19 January 2010 - 10:46am
Permalink
Thank
thank you for the advice in this post I really like the tutorial you
may be able to add my knowledge
I'm trying to let alone in the international destination java Indonesia
iPhone Apps (not verified)
21 January 2010 - 3:29pm
Permalink
nano´s answer
Hey Nano,
i have tried this "apt-get install nano" but it results in an error. Did you know anything about getting error?
Thanks for your help!
Adminz (not verified)
24 January 2010 - 3:01pm
Permalink
Nice
I was looking for this for a while now, thanks a lot of helping us out !
Melindaa (not verified)
5 February 2010 - 6:42pm
Permalink
nano
try sudo apt-get install nano instead
้เกมส์ (not verified)
9 February 2010 - 11:32am
Permalink
Thank
Thank for sharing.
Thanks for your help!
Camisetas (not verified)
4 September 2010 - 1:18pm
Permalink
VPS
I started with a VPS not knowing what SSH was, and through your article I plodded my way through the setup, which was about three weeks or so...A year later and now I have a dedicated server that I just populated...and I am Still referring to your article....thanks so much
Scalesmart (not verified)
5 April 2011 - 7:05am
Permalink
Thanks for the guide, I used
Thanks for the guide, I used it to try and fix my magento install, but its still broken so mut be a firewall issue. Your guide was clear and concise though, thanks!
Google Sniper Review (not verified)
14 April 2011 - 3:18am
Permalink
Everything it's complex at the beginning!
But after you learn it it becomes a simple task in your work... With the help of the Internet everyone can now learn what ever they like... You really made a great guide and it's so simple to follow and implement. Thanks
digital piano (not verified)
19 June 2011 - 6:21am
Permalink
Learning curve
Everything on the net requires a learning curve
my naruto blog (not verified)
2 July 2011 - 4:51pm
Permalink
thanks.
Thank for this - the whole modification of php.ini process was completely scary and very cool.
Google Sniper Dan (not verified)
4 September 2011 - 6:45am
Permalink
Thanks
Thanks so much for this article it is excellent! I didn't know how to modify PHP.ini using SSH. I still have a lot to learn but this will help a lot in my web development.
Google Sniper (not verified)
6 September 2011 - 3:51pm
Permalink
thanks this is very helpful!
thanks this is very helpful!
PC help (not verified)
26 February 2012 - 12:08pm
Permalink
Interesting
Thank you. This tutorial is really helpful. Thank you.
boise blinds (not verified)
18 July 2012 - 3:05pm
Permalink
SSH made easy! Thanks!
Thanks for the tips on using SSH with Plesk. VPNs can sometimes be confusing but changing the files can be done using a TXT editor just using the file manager inside of Bluehost or your specific hosting company. It's pretty easy these days especially when you find great tutorials like this one.
Add new comment