NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
how to find out the path of a script with php


Joined: 01 Apr 2008
Posts: 5
Reply with quote
Hi,

actually this is not a question about phped but since my problem only occurs in conjunction with phped I post it here.

On my pc I have a script in a directory formed like "c:\inetpub\wwwroot\project_path\projects_cms_path\index.php". I open the cms in the browser with "http://localhost/project_path/projects_cms_path\index.php".

Then I created a phped-project with the cms-directory as homedir. When running in the debugger the script-address is "http://localhost:8080/file:/c:/inetpub/wwwroot/project_path/projects_cms_path/index.php?..."

There is a http-redirect in the script to another file with the php-function header("location:..."). Since as per the rfc relative URLs are not allowed I want to form a absolute location starting with "http:..." Obviously this two URLs will be different in the both "run-enviroments". (Btw:the same problem accours at cms-created links)

I'm sure, it is possible to find the correct absolute path by using $_SERVER (or other env-vars), but several trials show me, that it is not trivial. So before I try to find a solution... does anyone has solved this problem?

Thanks in progress!
View user's profileFind all posts by khinkelmannSend private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
The using complete filenames is something the build in SRV does.
A normal webserver does not use complete physical paths.
Because SRV is kinda limited in functionality (for quick testing purposes only) it is not suited for situations like yours.
I would advise you to install a 3rd party web-server (apache or something like it), which will avoid those problems altogether.
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 01 Apr 2008
Posts: 5
Reply with quote
I actually use an apache on my pc... so SRV serves the requests from the debugger and the apache the requests from the browser. I still believe there is a solution based on the SERVER[]-values but since I'm lazy (as most coder) I'm using "if $_SERVER['PORT']=8080..." in the scriptconfiguration. Not elegant, but it works.
View user's profileFind all posts by khinkelmannSend private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
By default PhpED using the built in webserver for debugging because that is setup correctly and does not need extra configuration. This is done because and out of the box working solution is more user friendly and is enough initially.
However if you want to do more serious debugging this will not suffice, as I already said.

If you configure your project as being hosted on a "3rd party server", all you need to do to debug using your apache is install the php dbg module.
Then both browser and debug requests will be handled by the apache server and exit your issues.

Just open the PhpED manual and Checkout the "Debugging and Profiling" section.
There is a "Configuring Debugger" beneath that with a "Installing php debugger on 3rd party web servers" entry which should guide you through the process.
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 01 Apr 2008
Posts: 5
Reply with quote
Thanks for your tips - I'll try them within the next days. Concerning the build-in webserver you are SO right. Exactly this out-of-the-box-behavior was the reason for me to buy phped. Ofcourse it is a great editor but in the first place the simple and quick "edit-debug-loop" convinces a php-coder, who is stressed by thousands of print_r in the past ten years!
View user's profileFind all posts by khinkelmannSend private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
Haha trust me, I've been there as well. But then I discovered DBG. I think that at that time dmitri wasn't even working for NuSphere yet (not sure). So i started toying around with it, installed an editor that supported the debugger and my php-life has simplified (professionally that is Wink) a lot since. Dunno exactly when I found out about NuSphere itself. Probably after I wanted to update and saw it mentioned on the DBG webpage. Been hooked ever since.
I've tried products using XDebug and products supporting the Zend debugger and I still prefer PhpEd+DBG (even 5 years later).
View user's profileFind all posts by BlizzSend private messageVisit poster's website
how to find out the path of a script with php
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic