This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 152262 - PHP Debugger doesn't work with mod_rewrite
Summary: PHP Debugger doesn't work with mod_rewrite
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 13 votes (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks: 140918
  Show dependency tree
 
Reported: 2008-11-04 07:56 UTC by mteryk
Modified: 2012-04-10 12:27 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mteryk 2008-11-04 07:56:33 UTC
When using mod_rewrite to rewrite URLS, Netbeans IDE is unable to debug correctly. I have used wireshark to monitor the
communication with xdebug and it appears that xdebug is providing the correct file path for php files so Netbeans could
use this path to display/debug the appropriate files.

I am using Apache2 with mod_rewrite as provided in Ubuntu 8.04 distribution.

To reproduce:

1. Install Apache2 and enable mod rewrite (sudo a2enmod rewrite)
2. Modify "AllowOverride" directive for DocumentRoot in /etc/apache2/sites-enabled to allow uri rewriting and restart apache
3. Create file .htaccess in root source directory with following text


  RewriteEngine on
  RewriteBase /testproject
  RewriteCond $1 !^wwwroot/
  RewriteRule ^(.*)$ wwwroot/$1 [L]

4. Create new Netbeans PHP Project titled "testproject" with index.php in root source directory.
5. Select "Copy Files to New Directory" and enter directory titled "testproject" in DocumentRoot
6. Modify index.php in the root source directory to denote it's location when viewed (echo ("Root index file") )
7. Create subdirectory in sources directory called wwwroot
8. Create index.php file in wwwroot and modify to denote its location.
9. Leave or set "Stop at first line" in Tools -> Options -> PHP
10. Run debugger

Netbeans will stop at the first line and display the index.php from the root directory. Browser will display the
appropriate index.php from wwwroot when continuing.

Apologies if this is a dupe. I did find the following thread in the forums but couldn't find a logged issue for it.

http://forums.netbeans.org/viewtopic.php?t=1957&highlight=modrewrite
Comment 1 beberlei 2008-11-12 10:07:02 UTC
I have to extend this issue:

Websites that make heavy use of Mod Rewrite with non-existing subfolders cannot be debugged at all, since in the Project
"Run" Settings you can only specify an "Index File" that is existant.

It would probably help if the specified index file and the opened url for the browser could be different (although this
is possible by changing the global browser arguments, which is rather hackish and not cross project compatible).
Comment 2 beberlei 2008-11-12 10:58:25 UTC
In my opinion this has a higher priority than P3, because all frameworks with mvc use htaccess rewriting nowadays and
many other projects do so too (wordpress, typo3 for example) and its not really possible to work around this.
Comment 3 rmatous 2008-11-12 13:07:54 UTC
OK, thanks, so let's make it P2
Comment 4 kkruit 2010-01-14 12:33:48 UTC
Shouldn't this bug be marked as P1 as it blocks 140918 which is P1?
Comment 5 Filip Zamboj 2010-01-25 09:35:13 UTC
Quality Engineering: no, this isn't P1 at all, P2 is ok for this bug. Btw., #140918 is P1 enhancement not P1 defect - and that's kinda difference.
Comment 6 Filip Zamboj 2010-09-15 12:27:21 UTC
batch reassigning
Comment 7 monk.e.boy 2011-04-27 08:16:39 UTC
Just a quick comment. You can easily debug PHP that requires mod_reqrite (for example Zend Framework) you just need to set the project debug settings to 'Do Not Open Web Browser', then install an Xdebug plugin into your browser (e.g. 'Xdebug helper' for chrome). Press 'Debug Main Project' then start the Xdebug plugin in the browser, refresh the page you are on. This works fine.

I realise this is a bit of a ramble, but seeing as mod_rewrite is used in almost all PHP frameworks I think bundling an Xdebug plugin with Netbeans would be a great idea. That is, it solves this bug.

Or maybe the documentation needs updating?