Help - Search - Members - Calendar
Full Version: PHP Global Variables
The Planet Forums > Control Panels > Plesk
rufusstalin
Hello,
I am fairly new to plesk and to be honest so far it seems pretty cool.

One question though, is it possible to set global variables to On in individual domains as opposed to the php.ini script itself.
I have a few large sites that we've migrated and instead of changing the variables, as only we have access to the sites in question I would like to turn global variables on just for the sites in question.

Could this be done in the httpd.include file in /conf/ on the domains in question?

Also can someone explain how

php_admin_value open_basedir "/home/httpd/vhosts/widescope2k.co.uk/httpdocs:/usr/share/pear"

works? I understand that it is stopping scripts from accessing other files housed elsewhere on the server and how to switch it off, but I was wondering if you can alter it so that say only files in the httpdocs folder are accesible.

Does this make sense?

Anyway, cheers to everyone on here, so far I've found the forum very useful in setting everything up from domain names to which firewall to use.

Kind Regards
Steve
AutoSear
Hi Steve

It's important to remember that Plesk modifies the httpd.include file when you make changes in the control panel. Any changes you make to that file will be overwritten by Plesk, so you don't want to modify it.

Instead, you need to use a 'vhost.conf' file in your individual website's /conf directory. By default there isn't one in there, so go ahead and create one. The file can contain apache/domain configuration information that is specific to the site. It's where you need to configure your PHP globals and open basedir for your specific site.

Here's an example:

CODE
<Directory /home/httpd/vhosts/domain.com/httpdocs>

php_flag register_globals On

php_admin_value open_basedir "/home/httpd/vhosts/domain.com/httpdocs:/home/httpd/vhosts/domain.com/someotherdirectory:/tmp"

</Directory>


The above would turn PHP register globals ON for this site. It also specifies what directories are accessible by PHP for this domain. In this case, the domain's httpdocs (of course), someotherdirectory, and /tmp (to allow for file uploads).

After making changes to vhost.conf, you need to rebuild and restart Apache:

/usr/local/psa/admin/sbin/my_apci_rst (to rebuild apache)
/etc/init.d/httpd restart (to restart apache)


Hope this helps some icon_smile.gif
rufusstalin
Thanks autosear.

I had already changed the include file and got it working with register globals on. Didn't think about plesk overwriting it which does make sense considering it is designed to be used by non-programmers.

Whats the score with rebuilding apache? I mean what would the difference be if I just restarted it instead. Just wondering as I've never had to do this before.

Thanks anyway, greatly appreciated...

icon_biggrin.gif

Steve
AutoSear
Steve,
I'm not sure what the deal is with having to rebuild apache, I just know it works icon_biggrin.gif In my experience, if I edit a vhost.conf file and only restart Apache, the changes don't take effect. Luckily rebuilding Apache only takes a second, at least on my server with only 3 domains.

Best,
Auto

Edit: Just read on the Plesk forum that running my_apci_rst forces PSA to rebuild the httpd.include file.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.