NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Debug problem.
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
Hi.

I have been working some time on the same project.
After the last upgrade to build 5031 (ver 5.2) I can't debug any more.

I have not changed a thing in my settings during these upgrades so I do not understand what the problem is.

I have said no to overwrites of php.ini during install.

I used to run debugger in local srv mode, but If I do that now I get an error when I hit a include_once line.

This code :

Code:
echo getenv("DOCUMENT_ROOT");

if (substr(getenv("DOCUMENT_ROOT"),-1,1) == '/')
    include_once(getenv("DOCUMENT_ROOT") . 'bizConfiguration.php');
else
    include_once(getenv("DOCUMENT_ROOT") . '/bizConfiguration.php');

include_once(bizConfig::getSystemPath() . 'classes/tables/bizpayment_method.php');
include_once(bizConfig::getSystemPath() . 'classes/enums/paymentTestMode.php');

$paymentMethod = new bizpayment_method_table();


Gives me this error when I use the internal srv

Code:

C:\www\TechPlat\apache\htdocs\morgenfruen
Warning: include_once(C:\www\TechPlat\apache\htdocs\morgenfruen/bizConfiguration.php) [function.include-once]: failed to open stream: No such file or directory in C:\www\TechPlat\apache\htdocs\morgenfruen\components\com_tester\tester.php on line 9

Warning: include_once() [function.include]: Failed opening 'C:\www\TechPlat\apache\htdocs\morgenfruen/bizConfiguration.php' for inclusion (include_path='.;C:\Program Files\nusphere\phped\php5\..\include_lib;C:\Program Files\nusphere\phped\php5\PEAR') in C:\www\TechPlat\apache\htdocs\morgenfruen\components\com_tester\tester.php on line 9

Fatal error: Class 'bizConfig' not found in C:\www\TechPlat\apache\htdocs\morgenfruen\components\com_tester\tester.php on line 11


I am running windows xp as my development platform, and sometimes on some versions of PHP it has been a problem if you use \ as directory separator.

But this has not been a problem in earlier versions. I have tried to change the document root settings on the property sheet to use forward slash, but this is ignored when I save the settings.

If I change to external http server (I have an apache server running) I do not get these errors, but now the breakpoints have no effect. Not even if I place a breakpoint in the very first line of the code I am debugging.

What am I doing wrong.
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
Quote:
failed to open stream: No such file or directory in C:\www\TechPlat\apache\htdocs\morgenfruen\components\com_tester\tester.php on line 9

you may want to check if file does exist first. Most probably it does not.

Quote:
If I change to external http server (I have an apache server running) I do not get these errors

it's because you run another PHP installation under Apache and it may have different settings, for example include_path

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
dmitri wrote:
Quote:
failed to open stream: No such file or directory in C:\www\TechPlat\apache\htdocs\morgenfruen\components\com_tester\tester.php on line 9

you may want to check if file does exist first. Most probably it does not.

Quote:
If I change to external http server (I have an apache server running) I do not get these errors

it's because you run another PHP installation under Apache and it may have different settings, for example include_path


Hi Dmitri.

If the file did not exist it would not work even if I switched to the external http server, but when I switch to the external server it does not complain about the existing file. I think that my existing PHP version (5.2.4) is older than the version included with the latest build, and that the new version is more picky about the file paths on windows.

Please notice that the path is a mixture of backslash and forward slash and I think that is why it can't find the file, if I use the internal web server on windows. (Because forward slash is not a path separator on windows)
Is there a way to change this, cause changing the root folder to use forward slashes does not work in PHPed.

And during install I said NO to get the php.ini files overwritten, so the debugger should work using the external http, but using that the breakpoint is not catched.

And even if I did say YES to have the php.ini file overwritten, then that would not really change it, cause it will still not overwrite my php.ini settings for my external http server.

What do you think.?
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
Quote:
If the file did not exist it would not work even if I switched to the external http server, but when I switch to the external server it does not complain about the existing file


I'm not sure what happend to people today... (or may be to me alone)
Please read the other part of my answer. Hope it explains why it may happen.

and no, I did not encounter any problems with forward slashes vs backward ones under windows. Seems both work fine.

Quote:
And during install I said NO to get the php.ini files overwritten, so the debugger should work using the external http, but using that the breakpoint is not catched.

when installer asked to overwrite php.ini, it meant php that was already installed with phped. Not your web server's php.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
dmitri wrote:
Quote:
If the file did not exist it would not work even if I switched to the external http server, but when I switch to the external server it does not complain about the existing file


I'm not sure what happend to people today... (or may be to me alone)
Please read the other part of my answer. Hope it explains why it may happen.

and no, I did not encounter any problems with forward slashes vs backward ones under windows. Seems both work fine.

Quote:
And during install I said NO to get the php.ini files overwritten, so the debugger should work using the external http, but using that the breakpoint is not catched.

when installer asked to overwrite php.ini, it meant php that was already installed with phped. Not your web server's php.


Ok Sorry Dmitri, how would you be able to know that the include_path on the external server is not set to the above.

External Webserver : include_path=".;C:/www/TechPlat/apache/php/PEAR"
Internal webserver : include_path = ".;C:\Program Files\nusphere\phped\php5\..\include_lib;C:\Program Files\nusphere\phped\php5\PEAR"

So I may not have made it clear but it is not a matter of different include_path settings.

I HAVE FOUND THE PROBLEM.

It is the DOCUMENT_ROOT (the path to the server htdocs)
The external server has this pointing to c:\www\TechPlat\apache\htdocs but the internal has it pointing to c:\www\TechPlat\apache\htdocs\morgenfruen

Because this is what it is set to on the project properties.

Now WHY that has been set after the update I can't tell, I can tell you for SURE that I have been able to debug using the internal server before I made the update.

At some point I got an error opening PHPed about a project XML file that had errors, could that have something to do with the DOCUMENT_ROOT being changed ?
View user's profileFind all posts by hgrSend private message
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
Ok Dmitri.

I can see there is a small problem.

The internal webserver obviously sees the project ROOT directory as the webservers root (the DOCUMENT_ROOT environment variable).
There is no where in the project settings where I can change this DOCUMENT_ROOT setting.

And I do not want to change the ROOT directory to the same DOCUMENT_ROOT directory as my external web server, because then code completion will be useless, because of the other projects I am working on.

Is there a way I can control the DOCUMENT_ROOT setting per project basis?

It still does not explain why debugging using the external http server fails.
So I looked at phpinfo, and noticed that I was still using debugger 3.2.3, so I upgraded to the latest 3.2.12 and I downloaded the debugger wizard file and ran it.

It gave me this output.

Code:
 What did I find out about your system

I assume that you placed me in the directory of your main php script and on your PhpED machine pointed your browser to me - like this: <URL of your web site>/dbg-wizard.php

I see that:

    * PHP Version: 5.2.4
    * Web Server: Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8e PHP/5.2.4
    * Server Name: localhost
    * OS: WINNT
    * Your Client IP Address: 127.0.0.1
    * Your Server IP Address: 127.0.0.1
    * Port: 80
    * Your Web Server is on the same machine with PhpED
    * Path to website files: C:\www\TechPlat\apache\htdocs\morgenfruen\
    * Document Root is: C:\www\TechPlat\apache\htdocs\
    * Your PHP.INI file is C:\www\TechPlat\apache\bin\php.ini
    * PHP extensions directory is C:\www\TechPlat\apache\php\ext
    * DBG (PHP DEBUGGER) Version 3.2.12 is INSTALLED

How to setup your PhpED Project Properties

I can suggest the following settings for your Project to debug PHP scripts on Server localhost :
You can create new Project by selecting File->New Project or by selecting New Project in the Workspace Pop up Menu
In the Project Properties Dialog set:

    * Project -> Root Directory: C:\www\TechPlat\apache\htdocs\morgenfruen\
    * Mapping -> Run Mode: HTTP Mode (3-rd party WEB server)
    * Mapping -> Remote URL: http://localhost/morgenfruen/
    * Mapping -> Remote Root Directory: C:\www\TechPlat\apache\htdocs\morgenfruen\ , same as Project -> Root Directory. 


Ok so I created a simpel test fil named nusphere.php with this content

Code:
<?php
    echo(getenv("DOCUMENT_ROOT"));
?>


So to see if everything worked I tried to run it but got this error



Clicking OK opens the project settings



Please note that I have set this according to the debugger wizard file.
Question

So what do I do now, when I can't get the internal or external webserver to debug ?
Internal debugging requieres me to be able to overwrite the DOCUMENT_ROOT for the internal webserver, and external http debug won't work with the settings recommended by the excellent wizard.
View user's profileFind all posts by hgrSend private message
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
Ok I changed the Remote Root Directory to C:\www\TechPlat\apache\htdocs\ which is the same of my apache server.

But debugging still don't work.

If I run a file in the debugger and put a breakpoint in the very first line, it is ignored.

If I turn on the "Stop on the first line after run" then it goes into debug mode, but if I then press F5, all other breakpoints are just ignored.

This is very frustrating.

The log area has this text:

Failed to find a way to load "C:\www\TechPlat\apache\htdocs\morgenfruen\index2.php" remote file. Opening it using debugger protocol

I tried to copy the line above from the log to the clipboard using the right click feature, but this does not work.

Sad
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
Well, with Apache ("external" server as you call it), you have DOCUMENT_ROOT == WEB ROOT == C:\www\TechPlat\apache\htdocs\
With SRV ("internal" server as you call it) you have DOCUMENT_ROOT == PROJECT ROOT == C:\www\TechPlat\apache\htdocs\morgenfruen\

To avoid problems with include(), I'd highly recommend you not to use DOCUMENT_ROOT, but dirname(__FILE__) or have dot (.) in the include_path and use relative directories in the include().

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
dmitri wrote:
Well, with Apache ("external" server as you call it), you have DOCUMENT_ROOT == WEB ROOT == C:\www\TechPlat\apache\htdocs\
With SRV ("internal" server as you call it) you have DOCUMENT_ROOT == PROJECT ROOT == C:\www\TechPlat\apache\htdocs\morgenfruen\

To avoid problems with include(), I'd highly recommend you not to use DOCUMENT_ROOT, but dirname(__FILE__) or have dot (.) in the include_path and use relative directories in the include().


I can't I needed to find a way to place my configuration file to make sure that I would always be able to find it. Regardless of how you install my script. You see, I am trying to build a framework that can be installed into any CMS. Theoretically I can use the __FILE__ and then just ../../ until I get to the Path. I tried to build a solution that did that and it was a mess to include in many files.
The most secure way to make sure always to find the configuration file, is to "jump" straight to the DOCUMENT_ROOT, and place it there.

However this does not explain WHY the debugger does not pick up my breakpoints. And also why I have been able to debug for the last 6 months in this project and suddenly now can not.

With these project settings, things almost works.



The apache server runs my code from within PHPed, and I can run in debug mode, and get the debugger to stop at the very first line (if I turn on that feature) but it ignores my breakpoints, and something is not right since the log file showed the above mentiond error message.

This one.
Failed to find a way to load "C:\www\TechPlat\apache\htdocs\morgenfruen\index2.php" remote file. Opening it using debugger protocol
View user's profileFind all posts by hgrSend private message
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
Question Question

I don't understand it.

I changed the property settings to this.



And now everything is fine.
The only difference between this and what I have done previous, is that I removed the ending forward slash of the remote root and url

Now debugging works, and I am also able to run code from within phped.

Question
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
Could you please try add that slash back and check if it stops working again? (it should not stop)

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Debug problem.
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