January 9, 2008

Modify php.ini through SSH for Plesk

Tagged as:

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.

Post Information
david's picture
This article was written by david and published on
January 9, 2008 at 4:26pm.
The article was given the following tags:
Comment Information
Guest's picture
Magpie Coffeehouse
Feb 16, 2008
7:39am

Sounds complex!

no

Comment Information
david's picture
david
Feb 16, 2008
12:17pm

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.

Comment Information
Guest's picture
Demy
Jun 28, 2008
5:32am

Thank you David!
With few simple lines and a couple of links, you saved me! Smiling

Comment Information
Guest's picture
Jamie Le Souef
Jul 21, 2008
8:50pm

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 Smiling

Comment Information
Guest's picture
Anonymous
Dec 9, 2008
9:22am

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?

Comment Information
david's picture
david
Dec 9, 2008
11:16am

I don't think so. cPanel and Plesk use different structures. Maybe in the /conf/ file ?

Comment Information
Guest's picture
Anonymous
Dec 30, 2008
7:21pm

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

oha

Comment Information
Guest's picture
Felix
Mar 27, 2009
10:09am

Sound really complex ^^

Comment Information
david's picture
david
Apr 15, 2009
11:19am

it is complex. But doable with a little thinking.

Comment Information
Guest's picture
Picchio
Aug 6, 2009
7:00am

Very helpful! thx

Comment Information
Guest's picture
fax from computer
Oct 30, 2009
2:06pm

I have thought about moving to drupal but I am not very computer literate. So it looks very complicated.

Comment Information
Guest's picture
Clyde
Nov 16, 2009
3:02am

Thank for this - the whole modification of php.ini process was completely scary and very cool.

Comment Information
Guest's picture
Change of Address
Nov 25, 2009
7:12am

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! Smiling

Comment Information
Guest's picture
Moving
Nov 25, 2009
7:23am

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.

Comment Information
Guest's picture
bukmacher
Nov 30, 2009
7:02am

changing php.ini through command line is very difficult to me too, i had many problems but finally i have success, lesson learned Smiling

Comment Information
Guest's picture
Wilbert
Dec 4, 2009
10:09am

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.

Comment Information
Guest's picture
christophe
Dec 28, 2009
1:04pm

Tnaks for that article. I changed this file with no difficult.

Comment Information
Guest's picture
PotBelly pigs
Dec 28, 2009
5:54pm

thanks for this guide , its very helpfull.

Comment Information
Guest's picture
Kojak
Dec 28, 2009
7:44pm

Thanks for this. this is exactly what i am looking for!

Comment Information
Guest's picture
google sniper review
Dec 29, 2009
5:51am

Hello, thanks for this guide, just what I needed to modify the php.ini!

Comment Information
Guest's picture
Film gratis
Dec 29, 2009
8:46am

Thanks, you saved my ass today.
I've got a vps at linode and they are meant for true geeks eheh

Comment Information
Guest's picture
Feuerspucker
Dec 30, 2009
1:46pm

Great thanks und a happy new year - Good Tip - very nice!

Comment Information
Guest's picture
Kinder
Dec 31, 2009
8:39am

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.

Comment Information
Guest's picture
Sondora@aionfr
Jan 1, 2010
11:52am

Will try it out but don't think I will be able to do this

Comment Information

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

Comment Information
Guest's picture
Jon
Jan 8, 2010
5:11pm

it sounds like something i would definately mess uo trying to do, lol

Comment Information
Guest's picture
antike bilderrahmen
Jan 10, 2010
6:41pm

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

Comment Information
Guest's picture
Mr.Doors
Jan 17, 2010
1:42am

Thank for sharing. My site error about php.ini.

Thank so much.

Comment Information
Guest's picture
Kneipp
Jan 19, 2010
11:46am

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

Comment Information
Guest's picture
iPhone Apps
Jan 21, 2010
4:29pm

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!

Comment Information
Guest's picture
Adminz
Jan 24, 2010
4:01pm

I was looking for this for a while now, thanks a lot of helping us out !

Comment Information
Guest's picture
Melindaa
Feb 5, 2010
7:42pm

try sudo apt-get install nano instead Smiling

Comment Information
Guest's picture
้เกมส์
Feb 9, 2010
12:32pm

Thank for sharing.

Thanks for your help!

VPS

Comment Information
Guest's picture
Camisetas
Sep 4, 2010
2:18pm

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

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options