473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

apache passing value to php

Hello,

I'm wondering if there's a way to pass a value from apache to php
through httpd.conf. I've noticed that php settings can be changed
using php_value. Is there a way to send a value that is not one of the
settings to php in this way? Something like:

php_value my_dogs_name "sparky"

Then $my_dogs_name becomes globally accessible to all scripts on the
server. Specifically, I'd like to keep the name of the mysql db name
in the portion of httpd.conf associated with the virtual server that
uses it. I don't think I can use any of the php_value mysql.* settings
because I'm using PEAR DB. Any ideas? Thanks!
Jul 17 '05 #1
5 2337
See http://www.phpfreaks.com/apache_manu...d/mod_env.html

The value set would be in the $_ENV array.

Uzytkownik "go-tard" <go*****@yahoo.ca> napisal w wiadomosci
news:2e**************************@posting.google.c om...
Hello,

I'm wondering if there's a way to pass a value from apache to php
through httpd.conf. I've noticed that php settings can be changed
using php_value. Is there a way to send a value that is not one of the
settings to php in this way? Something like:

php_value my_dogs_name "sparky"

Then $my_dogs_name becomes globally accessible to all scripts on the
server. Specifically, I'd like to keep the name of the mysql db name
in the portion of httpd.conf associated with the virtual server that
uses it. I don't think I can use any of the php_value mysql.* settings
because I'm using PEAR DB. Any ideas? Thanks!

Jul 17 '05 #2
On Mon, 22 Mar 2004 14:48:38 -0500, "Chung Leong" <ch***********@hotmail.com>
wrote:
Uzytkownik "go-tard" <go*****@yahoo.ca> napisal w wiadomosci
news:2e**************************@posting.google. com...

I'm wondering if there's a way to pass a value from apache to php
through httpd.conf. I've noticed that php settings can be changed
using php_value. Is there a way to send a value that is not one of the
settings to php in this way? Something like:

php_value my_dogs_name "sparky"

Then $my_dogs_name becomes globally accessible to all scripts on the
server. Specifically, I'd like to keep the name of the mysql db name
in the portion of httpd.conf associated with the virtual server that
uses it. I don't think I can use any of the php_value mysql.* settings
because I'm using PEAR DB. Any ideas? Thanks!


See http://www.phpfreaks.com/apache_manu...d/mod_env.html

The value set would be in the $_ENV array.


Actually, having just tried it, it ends up in the $_SERVER array.

Possibly because it only adds it to the environment for CGI scripts and not
modules (which run inside the Apache process rather than as a subprocess). But
there appears to be some mechanism in place that passes values from SetEnv to
$_SERVER when running PHP as an Apache module.
--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #3
Uzytkownik "Andy Hassall" <an**@andyh.co.uk> napisal w wiadomosci
news:uc********************************@4ax.com...
See http://www.phpfreaks.com/apache_manu...d/mod_env.html

The value set would be in the $_ENV array.
Actually, having just tried it, it ends up in the $_SERVER array.

Possibly because it only adds it to the environment for CGI scripts and

not modules (which run inside the Apache process rather than as a subprocess). But there appears to be some mechanism in place that passes values from SetEnv to $_SERVER when running PHP as an Apache module.


Thanks for the correction. That make sense, since on some platforms (Win32
namely) Apache runs as a single process.
Jul 17 '05 #4
Thanks very much for your help. I've tried this and haven't found the
value available in either $_ENV or $_SERVER. I think I'm running php
as an apache module. Is there something I need to do to get this value
put into $_SERVER. Thanks.

"Chung Leong" <ch***********@hotmail.com> wrote in message news:<V7********************@comcast.com>...
Uzytkownik "Andy Hassall" <an**@andyh.co.uk> napisal w wiadomosci
news:uc********************************@4ax.com...
See http://www.phpfreaks.com/apache_manu...d/mod_env.html

The value set would be in the $_ENV array.


Actually, having just tried it, it ends up in the $_SERVER array.

Possibly because it only adds it to the environment for CGI scripts and

not
modules (which run inside the Apache process rather than as a subprocess).

But
there appears to be some mechanism in place that passes values from SetEnv

to
$_SERVER when running PHP as an Apache module.


Thanks for the correction. That make sense, since on some platforms (Win32
namely) Apache runs as a single process.

Jul 17 '05 #5
In article <2e**************************@posting.google.com >,
go*****@yahoo.ca (go-tard) wrote:
Hello,

I'm wondering if there's a way to pass a value from apache to php
through httpd.conf. I've noticed that php settings can be changed
using php_value. Is there a way to send a value that is not one of the
settings to php in this way? Something like:

php_value my_dogs_name "sparky"

Then $my_dogs_name becomes globally accessible to all scripts on the
server. Specifically, I'd like to keep the name of the mysql db name
in the portion of httpd.conf associated with the virtual server that
uses it. I don't think I can use any of the php_value mysql.* settings
because I'm using PEAR DB. Any ideas? Thanks!


SetEnv my_dogs_name "sparky"
print $_SERVER["my_dogs_name"];

--
Sandman[.net]
Jul 17 '05 #6

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

Similar topics

2
by: Johan den Boer | last post by:
Hi, Tried installation with apache 2.0.47. But nothing is working. Copied all the dll's and .ini file to the right locations. Changed the httpd.conf file as well. Here is what I added in...
6
by: John Dean | last post by:
Hi I have set up httpd.conf according to installation and configuration instructions in the mod_python documentation. Yet when I enter the following URL http://localhost/test.py all I get is an...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
3
by: John Murtari | last post by:
Folks, Trying to build php 4.4.6 and apache 1.3.37 on RHEL 4. Each of them builds and installs okay, but when we start apache we get: Syntax error on line 238 of...
4
by: liyanage | last post by:
I recently worked on error handling and three related issues/questions came up. 1.) I am trying to trigger Apache ErrorDocument handlers by setting appropriate HTTP status codes in my PHP...
6
by: MaiyaHolliday | last post by:
Hello, I've recently installed apache on a new computer, and cannot figure out why my site will not process any includes. (it was working on my old one) There are no errors on the page such as...
3
by: amanjsingh | last post by:
Hi, I am trying to implement Java Web Service using Apache Axis2 and Eclipse as a tool. I have created the basic code and deployed the service using various eclipse plugin but when I try to invoke...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
6
by: josequinonesii | last post by:
I've searched, I've read, I've tested and re-read numerous post but to no avail yet... Quite simply, the settings I've applied to my httpd.conf, httpd-vhost.conf and my hosts files simply does not...
0
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,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.