Problem mit DOCUMENT_ROOT

Discuss general web development questions. Help others and get help from others.

Moderator: kfury77

Problem mit DOCUMENT_ROOT

Postby bekon » Sat Mar 29, 2014 12:03 pm

Wegen eines unerklärlichen Fehlers in einem PHP-Sript habe ich mich entschlossen, RapidPHP zu testen.
Und bin gleich gestolpert.

Seit langem läuft meine Page local(Xampp) sowie Online.
Auch RapidPHP kann ich alle Seiten anschauen - bis zum LOGIN (MyPHPLogin)
Hier stimmt plötzlich $_SERVER['Document_root'] nicht mehr!

Statt [DOCUMENT_ROOT] => G:/xampp/htdocs/CGS
bekomme ich nur
[DOCUMENT_ROOT] => G:/xampp/htdocs
zurück und damit ist ende und ich kann Scripts innerhalb des LOGIN-Systems nicht mehr testen.

Es kommen natürlich Fehlermeldungen wie diese :
Warning: include(G:/xampp/htdocs/PHP/mysql.inc) [function.include]: failed to open stream: No such file or directory in G:\xampp\htdocs\CGS\PHP\Login\login.php on line 6
Hinter htdocs fehlt CGS.

Auch bis zum LOGIN wird $_SERVER['Document_root'] ständig benutzt und funktioniert.
Wie kann es dann passieren, das $_SERVER['Document_root'] verschiedene Werte zurück gibt?

Hier die ersten Zeilen des LOGINS:
Code: Select all
$Server_Name=$_SERVER["SERVER_NAME"];
$Root="/PHP/Login/";
include($_SERVER["DOCUMENT_ROOT"]."/PHP/mysql.inc");
include_once($_SERVER["DOCUMENT_ROOT"]."/PHP/Login/lang/lang_DE.php");
include_once($_SERVER["DOCUMENT_ROOT"]."/PHP/log.php");
.
.
.


Danke für schnelle Problemlösung ;)
bekon
 
Posts: 6
Joined: Sat Mar 29, 2014 11:25 am

Re: Problem mit DOCUMENT_ROOT

Postby Aivars » Tue Apr 01, 2014 11:08 am

Do I understand it correctly - your script displays correctly in browser via http://localhost/PHP/login/login.php but not in RapidPHP preview?

Check under Options -> Preferences -> PHP Settings that you use the same xampp instance, then check Options -> Preferences -> Preview -> Web Server Settings, and then check Options -> Preferences -> Preview -> Mappings and make sure that everything seems correct.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Problem mit DOCUMENT_ROOT

Postby bekon » Wed Apr 02, 2014 10:12 am

Thank you aivars
everything is working fine online and offline (with xampp).
And I can see all Pages correctly in RP-Preview except the LOGIN-Page (and of course the following pages)
Have a look at http://www.chariots.de/intern/intern.php.
So I think, Preferences are OK.

The correct $_SERVER['Document_root']=G:/xampp/htdocs/CGS , but on the LOGIN-Page it is
$_SERVER['Document_root']=G:/xampp/htdocs

Why $_SERVER['Document_root'] is changed in the LOGIN-Page?
Error:
Warning: include(G:/xampp/htdocs/PHP/mysql.inc) [function.include]: failed to open stream: No such file or directory in G:\xampp\htdocs\CGS\PHP\Login\login.php on line 5
bekon
 
Posts: 6
Joined: Sat Mar 29, 2014 11:25 am

Re: Problem mit DOCUMENT_ROOT

Postby Aivars » Wed Apr 02, 2014 1:59 pm

Can you call phpinfo() in login.php and check if there's something strange going on?
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Problem mit DOCUMENT_ROOT

Postby bekon » Wed Apr 02, 2014 3:49 pm

In Firefox with Xampp phpinfo() in Login.php says:
$_SERVER['Document_root']=G:/xampp/htdocs/CGS

In RP Preview i miss /CGS in $_SERVER['Document_root']=G:/xampp/htdocs
bekon
 
Posts: 6
Joined: Sat Mar 29, 2014 11:25 am

Re: Problem mit DOCUMENT_ROOT

Postby bekon » Tue Apr 08, 2014 12:19 pm

No idea?
I have 15 starts left for testing.
And I will buy RP, when this problem is solved.
bekon
 
Posts: 6
Joined: Sat Mar 29, 2014 11:25 am

Re: Problem mit DOCUMENT_ROOT

Postby Aivars » Wed Apr 09, 2014 4:08 pm

Did you verify these settings?
Options -> Preferences -> PHP Settings
Options -> Preferences -> Preview -> Web Server Settings
Options -> Preferences -> Preview -> Mappings

Maybe you have added something different from xampp settings.

If you're not sure whether it's correct or not, you can send me a screenshot.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Problem mit DOCUMENT_ROOT

Postby bekon » Wed Apr 09, 2014 10:20 pm

Aivars wrote:Did you verify these settings?
Options -> Preferences -> PHP Settings : Path to PHP.exe= G:\xampp\php\php.exe
Options -> Preferences -> Preview -> Web Server Settings:Port89---G:\xampp\htdocs\CGS---G:\xampp\php\php-cgi.exe
Options -> Preferences -> Preview -> Mappings: Local= G:\xampp\htdocs\ ---Webserver= http://localhost/

I've tried all posible Mappings
bekon
 
Posts: 6
Joined: Sat Mar 29, 2014 11:25 am

Re: Problem mit DOCUMENT_ROOT

Postby Aivars » Fri Apr 11, 2014 10:45 am

First of all this
Mappings: Local= G:\xampp\htdocs\ ---Webserver= http://localhost/
should be
Mappings: Local= G:\xampp\htdocs\CGS ---Webserver= http://localhost/

And make sure "Use folder mapping when displaying preview" is checked.

When you change the settings, restart RapidPHP, then preview login.php. Preview it in Internet Explorer instead of Chrome, right click the preview -> Properties. Is the address (URL) correct?
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Problem mit DOCUMENT_ROOT

Postby bekon » Fri Apr 11, 2014 3:14 pm

If I change settings and debug starting with index.php, i get the Xampp-Page (Localhost/xampp).
May be there is an problem with my xampp-settings.
I'm using virtual hosts and my 'normal' Url offline is: LOC.cgs.de instead of http://WWW.cgs.de.

Code: Select all
<VirtualHost *:80>
    ServerAdmin bernd@kondermann.net
    DocumentRoot "G:/xampp/htdocs/CGS"
    ServerName loc.cgs.de
    ServerAlias loc.cgs.de
    <Directory "G:/xampp/htdocs/CGS">
    Order allow,deny
    Allow from all
    DirectoryIndex index.html index.htm index.php
    </Directory>

</VirtualHost>



I will check it soon.
bekon
 
Posts: 6
Joined: Sat Mar 29, 2014 11:25 am


Return to Web Developer Talk

Who is online

Users browsing this forum: No registered users and 7 guests

cron