LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   editing a php.ini file (https://www.linuxquestions.org/questions/linux-general-1/editing-a-php-ini-file-342716/)

ilustrate 07-13-2005 02:55 AM

editing a php.ini file
 
i received this error on an osCommerce installation in my new Virtual Private Server running Plesk 7.53 reloaded Linux / Unix.

FATAL ERROR: register_globals is disabled in php.ini, please enable it!

i have never ever edited a file directly on a webserver and need to:

i managed login via SSH and have reached the

[root@admin root]#

how do i proceed to find php.ini so that i can edit it?

once found how do i edit it?

fouldsy 07-13-2005 07:15 AM

The php.ini will usually be located within the /etc directory, but can then vary depending on the Linux distro running on it. Usually it's fairly easy, there will be a folder called php or php4 within /etc and then possibly another folder called apache within it. For example, on my Debian systems, I would:
Code:

cd /etc/php4/apache
and that's where php.ini is located. It may /etc/php/php.ini on your system, so have a look for a folder called php with /etc/ To change directory, you simply type
Code:

cd directoryname
Once you've found the file, there are few different editors you could use, of which 'vi' is most likely to work on all systems, so again, as an example:
Code:

vi /etc/php4/apache/php.ini
would let me edit the php.ini file on my system. There will be a line saying 'register_globals off' which you simply edit to say 'register_globals on'. It's usually disabled by default to prevent problems happening with your php code, and I'm surprised a pre-built solution needs it turning on.

Get back in touch if you'restill having problems.

TruckStuff 07-13-2005 09:31 AM

run the following
Code:

# echo '<? phpinfo(); ?>' | php | grep ini
to find the location of your php.ini file.

KimVette 07-13-2005 11:37 AM

Instead of enabling register_globals globally, enable it for the specific directory for that web application.

create an .htaccess file in the directory where you need register_globals and put this code in it:

Code:

# Override PHP settings. The first IfModule is
# for Apache 1.3, the second for Apache 2.
<IfModule mod_php4.c>
  php_value register_globals 1
</IfModule>
<IfModule sapi_apache2.c>
  php_value register_globals 1
</IfModule>

I have a complete register_globals howto posted on my web site at http://kim.biyn.com/Linux/enabling_r...r_virtual_host if you need more details.

ilustrate 07-13-2005 12:16 PM

thank you that was very helpful


All times are GMT -5. The time now is 11:50 PM.