Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i found my php.ini file in the etc directory in my remote server, if i wanted to change the file contents, how could i do that, can's i first download the file change it then upload it using ssh clinet? sorry newbie :))

share|improve this question
    
Are you using shared hosting? From your responses below, that would seem to be the case. If so, then you're not going to be able to edit php.ini. –  EEAA Oct 14 '10 at 0:08

4 Answers 4

up vote 0 down vote accepted

If you haven't neccesary access level to alter the /etc/.../php.ini it's possible that your hosting let's you to modify your php variables via .htaccess files

To use this, try to place an .htaccess file in your root path.

to modify a flag (on/off value) use:

php_flag <config_item> <new_value>

to modify a variable use

php_value <config_item> <new_value>

example:

php_flag register_globals off
php_value include_path ".:/usr/local/lib/php:/home/hosting/path"

If doing so you got an error 500 either the syntax of your file is wrong or your hosting don't let you alter php parameter by this method.

Ask your provider anyway.

share|improve this answer

There is probably a text editor installed on the server - you can use that to edit the file.

Personally I'm partial to nano, but there's emacs, vi (to mention more popular ones) and many more.

To edit the file, issue the command (for example) nano ./php.ini and that will bring up your editor where you can make changes.

As you mentioned, there's also the possibility of downloading the file to your local machine, editing and uploading it back - but in my opinion, that's normally a waste of time since you would only normally change a few config values, for which the server side text editor is just so much quicker to do.

share|improve this answer
    
its said -bash: nano: command not found for nano ./php.ini by the way im using plesk –  Solomon Saleh Oct 13 '10 at 22:11
    
If you get that, it means nano isn't installed. Does your provider tell you a specific text editor is pre-installed? If so, you should use that. If you want, you could always install another editor using the tools provided to you (such as apt-get or yum). –  Ben Pilbrow Oct 13 '10 at 22:13
    
no it deosnt i tried searching for it, but thiers nothing , on my file manager on plesk thier is a file editor thier, but how do i access that thorugh ssh client, it deosnt have a name –  Solomon Saleh Oct 13 '10 at 22:21
    
i found the rpm packagae for nano, im trying to install on my server –  Solomon Saleh Oct 13 '10 at 22:27
    
it wnt let me install it –  Solomon Saleh Oct 13 '10 at 22:32

If I were you, I'd learn to use a text editor such as nano, vim, or emacs, so that you can edit it directly on the server (after making a backup copy, of course).

share|improve this answer
    
my server wnt let me access the php.ini only through ssh client(PUTTY) –  Solomon Saleh Oct 13 '10 at 22:04

I guess your using Windows on your client machine then, so let's go from here.

If you don't have (or more probably can't find) a usable editor on your server you could use WinSCP to up- and download files via ssh/sftp. It also has a simple editor integrated to "directly" modify files on the server.

PuTTY also has a command line scp client pscp.exe which enables you to up- and download files from and to your server... but i guess WinSCP is the easier solution.

HTH

P.s. If you tell us a bit more about your server/hosting setup somebody here might be able to help you out on how to add software to your server or how to find out what's already installed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.