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 :))
4 Answers
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.
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.
-
its said
-bash: nano: command not found
fornano ./php.ini
by the way im using plesk Oct 13, 2010 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 asapt-get
oryum
). Oct 13, 2010 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 Oct 13, 2010 at 22:21
-
i found the rpm packagae for nano, im trying to install on my server Oct 13, 2010 at 22:27
-
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.
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).
-
my server wnt let me access the php.ini only through ssh client(PUTTY) Oct 13, 2010 at 22:04
php.ini
.