PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > _SERVER['DOCUMENT_ROOT'] not set?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
_SERVER['DOCUMENT_ROOT'] not set?

Réponse
 
LinkBack Outils de la discussion
Vieux 29/08/2008, 10h39   #1
Saurabh Agrawal
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut _SERVER['DOCUMENT_ROOT'] not set?

Hello group,

I am new to php. I have just bought a good book by Welling and Thomson and
was following the example codes.

In one of the examples, I am supposed to access _SERVER['DOCUMENT_ROOT'].
However, when I am seeing its value in the debug stack, I am getting it to
be null! Even phpinfo() is showing that this particular variable does not
even exist, though there are other _SERVER[''] declarations.

I installed everything on my local computer using xampp and I am using Zend
IDE.

And I have searched through archives as well as google and not found any
useful advice.

Thanks!

Saurabh.

  Réponse avec citation
Vieux 29/08/2008, 11h40   #2
David Otton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] _SERVER['DOCUMENT_ROOT'] not set?

2008/8/29 Saurabh Agrawal <mailsaurabh@gmail.com>:

> In one of the examples, I am supposed to access _SERVER['DOCUMENT_ROOT'].
> However, when I am seeing its value in the debug stack, I am getting it to
> be null! Even phpinfo() is showing that this particular variable does not
> even exist, though there are other _SERVER[''] declarations.


What's DocumentRoot set to in your Apache config? (httpd.conf) Check
any VirtualHost blocks you might have, too.

What's the result of print_r($_SERVER); ?

--

http://www.otton.org/
  Réponse avec citation
Vieux 29/08/2008, 13h27   #3
Saurabh Agrawal
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] _SERVER['DOCUMENT_ROOT'] not set?

>
>
> > In one of the examples, I am supposed to access _SERVER['DOCUMENT_ROOT'].
> > However, when I am seeing its value in the debug stack, I am getting it

> to
> > be null! Even phpinfo() is showing that this particular variable does not
> > even exist, though there are other _SERVER[''] declarations.

>
> What's DocumentRoot set to in your Apache config? (httpd.conf) Check
> any VirtualHost blocks you might have, too.
>
> What's the result of print_r($_SERVER); ?
>



In httpd.conf,

DocumentRoot "D:/xampp/htdocs"

No VirtualHost blocks.

David, I just found a thing. I had been running this script within the Zend
IDE, looking at output in the IDE itself. Now that I see the output in
Firefox, I can see the variable in phpinfo(), as well as in the output of
print_r($_SERVER).

It must be something to do with Zend, then. Is that it?

Even the output of print_r contains the line
[DOCUMENT_ROOT]=>D:/xampp/htdocs in Firefox, but no such line in Zend!

Thanks for the !

Saurabh.

  Réponse avec citation
Vieux 29/08/2008, 13h36   #4
metastable
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] _SERVER['DOCUMENT_ROOT'] not set?

Does Zend use a separate instance of Apache or some other webserver ?

Stijn


Saurabh Agrawal wrote:
>>
>>> In one of the examples, I am supposed to access _SERVER['DOCUMENT_ROOT'].
>>> However, when I am seeing its value in the debug stack, I am getting it
>>>

>> to
>>
>>> be null! Even phpinfo() is showing that this particular variable does not
>>> even exist, though there are other _SERVER[''] declarations.
>>>

>> What's DocumentRoot set to in your Apache config? (httpd.conf) Check
>> any VirtualHost blocks you might have, too.
>>
>> What's the result of print_r($_SERVER); ?
>>
>>

>
>
> In httpd.conf,
>
> DocumentRoot "D:/xampp/htdocs"
>
> No VirtualHost blocks.
>
> David, I just found a thing. I had been running this script within the Zend
> IDE, looking at output in the IDE itself. Now that I see the output in
> Firefox, I can see the variable in phpinfo(), as well as in the output of
> print_r($_SERVER).
>
> It must be something to do with Zend, then. Is that it?
>
> Even the output of print_r contains the line
> [DOCUMENT_ROOT]=>D:/xampp/htdocs in Firefox, but no such line in Zend!
>
> Thanks for the !
>
> Saurabh.
>
>


  Réponse avec citation
Vieux 29/08/2008, 13h47   #5
Saurabh Agrawal
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] _SERVER['DOCUMENT_ROOT'] not set?

On Fri, Aug 29, 2008 at 5:06 PM, metastable <listpit@metastable-services.net
> wrote:


> Does Zend use a separate instance of Apache or some other webserver ?
>
> Stijn
>
>

Actually I don't know the answer to this. How can I find that out?

AFAIK, while custom installation, it didn't ask for any such option.

Thanks!

Saurabh.

  Réponse avec citation
Vieux 29/08/2008, 14h01   #6
Stut
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] _SERVER['DOCUMENT_ROOT'] not set?

On 29 Aug 2008, at 12:47, Saurabh Agrawal wrote:
> On Fri, Aug 29, 2008 at 5:06 PM, metastable <listpit@metastable-services.net
>> wrote:

>
>> Does Zend use a separate instance of Apache or some other webserver ?
>>
>> Stijn
>>
>>

> Actually I don't know the answer to this. How can I find that out?
>
> AFAIK, while custom installation, it didn't ask for any such option.


Zend Studio does not install Apache at all. By default, when you run a
file from within the IDE it does so as a CLI script. This means there
will be no DOCUMENT_ROOT defined which is what you're seeing.

-Stut

--
http://stut.net/
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 20h22.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10920 seconds with 14 queries