0

On my PHP 5.5 server I run the production system in one folder and the development one in another using the same web server - which is great as the testing on the development code is done on the same environment as production.

Now the problem is that I would like to use XDebug for debugging in the development folder. I can load the xdebug extension in php.ini, but then that will also affect the production folder, which is obviously not desirable (see other threads about performance hits and security issues and in just overall never have XDebug loaded for production).

Since PHP 5.3 I cannot load extensions with the dl() function dynamically, so I don't see any way to get this extension loaded only for the development folder.

Did I miss anything? Any way to load PHP extensions like XDebug dynamically only for certain folders?

EDIT: I'm using Apache with FCGI

Zoltan Fedor
  • 2,004
  • 2
  • 23
  • 40
  • I strongly advise a setup where testing code cannot cause performance problems with live code (virtual machines are cheap). However, if that's out of reach, easiest would be to start 2 different webservers with different config (the other one listening on port 81 or something). – Wrikken Aug 19 '14 at 16:18
  • Are you using Apache? If so, are you using mod_php or FCGI/FPM? – Machavity Aug 19 '14 at 16:20
  • Hi Machavity, I'm using Apache with FCGI – Zoltan Fedor Aug 19 '14 at 16:26
  • Hi Wrikken, I agree, this is why I don't want to add XDebug if I cannot separate it out from the production system. The reason for the testing code to live on the same server is not costs (virtual machines are really cheap), but that there is a complicated back-end system with lots of data, so it would be hard to build and maintain an up-to-date separate test system. The same issue with the 2 different webservers idea - it can be done, but then testing has to count with the different webserver settings. But if nothing else, we might go that way. – Zoltan Fedor Aug 19 '14 at 16:29
  • Would this be any use, assuming you can create a virtual host http://stackoverflow.com/questions/15423705/how-can-i-use-xdebug-to-debug-only-one-virtual-host – RiggsFolly Aug 19 '14 at 16:54
  • Hi RiggsFolly, thanks, but others reported performance hits as soon as XDebug module is loaded, even when no debugging, see http://stackoverflow.com/questions/3522182/will-enabling-xdebug-on-a-production-server-make-php-slower, so I was planning not to have it loaded for the production side at all. – Zoltan Fedor Aug 19 '14 at 17:07

0 Answers0