Solved

On dedicated linux server with multiple sites, per-site php.ini not working

Posted on 2011-02-14
2
394 Views
Last Modified: 2012-05-11
I have a dedicated Linux server (CentOS) and have multiple name based sites.  I have one site which requires register_globals to be on (I know, I know, it shouldn't need this, but it's a legacy site and can't be easily fixed or upgraded) and another new site which requires register_globals to be off.  The /etc/php.ini file says register_globals On
If I try to set the per-site php.ini file (/home/virtual/site1/fst/etc/php.ini) to say register_globals Off
it doesn't work.  (I restarted apache).  What is the point of the per-site php.ini if you can't set things per site?  Or am I just doing something wrong?
0
Comment
Question by:mignonnedavis
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
florjan earned 500 total points
ID: 34891312
I don't think that php.ini should be for each virtual site. As far as I know from my sysadmin exp on archlinux and gentoo you should use php_value in vhost file (ussualy found in /etc/apache/vhosts.d/ or /etc/apache2/vhosts.d/). So to change a value for a site you put
php_value php_directive "value"
so for your example
php_value register_globals "Off"

Open in new window

or if you do not wish it to be overridable by .htaccess
php_admin_value register_globals "Off"

Open in new window

If you wanted you could also check apache documentation on this subject.
http://php.net/manual/en/configuration.changes.php
0
 
LVL 4

Expert Comment

by:florjan
ID: 34891356
Sorry a minor mistake. For on/off you should use php_flag. So
php_flag register_globals "Off"

Open in new window

php_admin_flag register_globals "Off"

Open in new window

The code in my last comment would still work, however it's not in specification with php manual.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now