473,670 Members | 2,563 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Virtual servers and $_SERVER[DOCUMENT_ROOT]

Hello,

I'm new to php and was wondering if someone could help me out with the best
way to accomplish this.

I have Solaris 9/Apache 1.3.31/PHP 5.1.4 that I compiled from source code
and installed.

I have multiple virtual web servers configured in httpd.conf and php scripts
run only if they are placed in my first VirtualHost DocumentRoot directory
as defined in httpd.conf:

<VirtualHost X.X.X.X:80>
DocumentRoot /usr/local/apache/sites/webdocdir
</VirtualHost>

I would like to get php scripts to run in one of my other virtual servers
defined in httpd.conf.

Right now, my $_SERVER[DOCUMENT_ROOT] gets defined (I think) from httpd.conf
such that it points to /usr/local/apache/sites/webdocdir. This I can see
from the results of a phpinfo().

Is there some way of configuring Apache and/or php so that I am not forced
to put php scripts in /usr/local/apache/sites/webdocdir?

thanks for any help,

George
Jun 23 '06 #1
2 4331
On Fri, 23 Jun 2006 13:51:18 -0400, George Zervakos wrote:
Hello,

I'm new to php and was wondering if someone could help me out with the best
way to accomplish this.

I have Solaris 9/Apache 1.3.31/PHP 5.1.4 that I compiled from source code
and installed.

I have multiple virtual web servers configured in httpd.conf and php scripts
run only if they are placed in my first VirtualHost DocumentRoot directory
as defined in httpd.conf:

<VirtualHost X.X.X.X:80>
DocumentRoot /usr/local/apache/sites/webdocdir
</VirtualHost>

I would like to get php scripts to run in one of my other virtual servers
defined in httpd.conf.

Right now, my $_SERVER[DOCUMENT_ROOT] gets defined (I think) from httpd.conf
such that it points to /usr/local/apache/sites/webdocdir. This I can see
from the results of a phpinfo().

Is there some way of configuring Apache and/or php so that I am not forced
to put php scripts in /usr/local/apache/sites/webdocdir?

thanks for any help,

George


The ScriptAlias directive will do this for you.;

Steve

Jun 24 '06 #2
George Zervakos wrote:
Hello,

I'm new to php and was wondering if someone could help me out with the best
way to accomplish this.

I have Solaris 9/Apache 1.3.31/PHP 5.1.4 that I compiled from source code
and installed.

I have multiple virtual web servers configured in httpd.conf and php scripts
run only if they are placed in my first VirtualHost DocumentRoot directory
as defined in httpd.conf:

<VirtualHost X.X.X.X:80>
DocumentRoot /usr/local/apache/sites/webdocdir
</VirtualHost>

I would like to get php scripts to run in one of my other virtual servers
defined in httpd.conf.

Right now, my $_SERVER[DOCUMENT_ROOT] gets defined (I think) from httpd.conf
such that it points to /usr/local/apache/sites/webdocdir. This I can see
from the results of a phpinfo().

Is there some way of configuring Apache and/or php so that I am not forced
to put php scripts in /usr/local/apache/sites/webdocdir?

thanks for any help,

George


George,

You might try alt.apache.conf iguration for some help.

It does work; I have my Apache set up with multiple virtual hosts and PHP works
fine in any directory in each host.

I don't know what you've got incorrect in your Apache configuration, but it's
not ScriptAlias.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8461
by: Tom | last post by:
I'm trying to dynamically adjust the path for one of my scripts using this: $script_path = str_replace( $_SERVER, "", dirname(realpath(__FILE__)) ) . DIRECTORY_SEPARATOR; The problem: the server I'm currently testing it on returns for $_SERVER something like the path "home/user/path/" and for __FILE__ "home2/user/path/scriptdir/" I tried to trace the discrepancy running phpinfo, but the only reference I can find to
4
16122
by: Chris | last post by:
I'm working on a large intranet group site with a lot of pages, file types, folders, subfolders, etc. I am using the include ('../includes/file.php') , but I would like to have a single snippet that will work for all .php/.html pages in all subfolders. I have seen the $_SERVER indicated as a way to access the root of the website without using ../ for each folder you have to pass up through. However, I cannot get this to work for me. ...
4
2390
by: monomaniac21 | last post by:
Why does this find the file: <img src="<?=$_SERVER?>/images/viessmann_header_logo.gif"> But this does not? $right_content = $_SERVER."includes/content/content.php";
12
2330
by: comp.lang.php | last post by:
Env: Windows XP, Apache 1.33, PHP 5.2.0 <? echo is_dir($_SERVER) . " for dir = " . $_SERVER); ?>
17
1684
by: Paul | last post by:
On my development computer, I have virtual named host set up, like www.site1.lab. When I upload those to my web site for customer review under mywebsite.com/clients/site1/ it throws some of the source file references off and it does not work properly. My references are like: require_once($_SERVER."/utility/top.php");
4
4130
by: Ronald Raygun | last post by:
I have just discovered that the value reported for $_SERVER by phpinfo is different from the value I obtain when I run the following: <?php echo $_SERVER ?> My natural assumption is to assume that this is a joke (like most of the PHP language in my experience so far) - but seriously, does anyone know why on earth a diagnostic tool like phpinfo() displays values that are different from that obtained via a script call?
6
3503
by: Jeff | last post by:
Is $_SERVER alway available? I ask this because I've seen on windows that the perl equivalent was missing. Is this settable and accessible the same way (ie not having to use global)? Jeff
0
8466
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8384
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8810
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8590
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8659
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6211
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2798
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2035
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.