Using Xdebug & Zend Debugger Simultaneously? - php

Is it possible to run both debuggers within the same PHP installation simultaneously. They both use different ports so communication with the client IDEs/other apps wouldn't be an issue.
I ask only because using the Zend Debugger with ZendStudio has proven to be much easier (fewer steps to start/stop debugging from the browser), but I really like some of the profiling tools available that only work with XDebug. So in a nutshell, I would love to be able to have the best of both worlds if possible.

http://www.suspekt.org/2008/08/04/xdebug-203-stealth-patch/ (in particular the last comment) seems to indicate that the profiling parts of Xedebug will work fine alongside Zend Debugger, with the patch installed.

It is possible - the simplest way on a development web server would be to run 2 different apache processes with different php.ini files referencing the different debugger modules

So, XDebug is known not to work with many Zend tools (I know Zend Optimizer for certain, I don't know about Zend Debugger but I wouldn't be surprised if XDebug has a built-in check for that).
Since you're running the debugger and profiler on a dev machine, I don't see why you can't maintain two separate ini files. Otherwise, you'll have to compile a custom version of yourself that bypasses the checks.

Related

PHP (Zend Framework) Code Profiling on Rackspace Cloud Sites

I have an application written on top of the Zend Framework that is hosted on Rackspace Cloud Sites. I want to be able to do code profiling, but I don't know where to begin. The code profiling tools I've seen require installation on the server.
I already use Zend_Log_Writer_Firebug for query profiling, and would like something similar for code profiling. What are my options?
To profile a program, you irremediably need another program loaded in memory, so there is no way to do it "outside".
Xdebug or Zend Debugger allows you to profile your code, and you can set it up to use it remotely, but you still need to install it your server.
You can also take a look at APD (stands for Advanded PHP Debugger) which is part of the PECL.
You could find workaround, or 'PHP' solution, but neither would be accurate or valuable I think.
Anyway, you should not install such tools on live server, however, you can easily install Xdebug through PEAR on your development environment.
The result doesn't need to be accurate, the proportion should remains the same, whatever the env you use.
It doesn't matter if your server is I7 Core Xeon 6Ghz or whatever, and your development server is an old Cyrix K6, when there are bottlenecks, they'll be here and there.
As you are already using Zend_Log_Writer_Firebug , you may have tried zfdebug.
What about xhprofile ? I have not used, but may be good to try :)

Profiler for Zend Server (Zend Debugger)

I'm looking for a PHP profiler that works with Zend Server (CE). From what I can tell, XDebug is a pain to setup with Zend Server. While Zend Debugger is free (as I understand it), the Profiler is only on Zend Studio.
Any other options?
I wish I could will you Zend Studio, as the profiler component is quite nice.
XDebug (standalone tip) may be your only option, unfortunately.
Do you have the option of upgrading to Zend Server 5 Professional edition? The Code Tracing feature would help you in profiling. Or, have you looked at PQP or DBG for Eclipse?
I wish I could be more help. The company I work for uses Zend Server for all deployments and the engineers all have Zend Studio.
Good luck.
A late answer, but might still be handy for those who find this question via searching (like I did).
I have Zend Server CE and PHPStorm on a Windows configuration and also wanted to profile some pages. It turned out that since a while it is just built-in in PHPStorm! With the explanation on this page: http://devnet.jetbrains.net/thread/432088 it was a breeze to get it up and running.
PHPStorm is not free (it is for individuals that do open source development) but its prices are absolutely affordable and are paid back for within days looking at the increasement in productivity.
You should consider the Semantic Designs PHP Profiler.
Doesn't require XDEBUG to be installed. Doesn't require any special configuration of your server. Works with huge PHP applications.

Is there a true all-in-one solution for PHP Development?

I'm looking for a "SINGLE INSTALLER" solution for PHP Development.
Is there anything out there which will give me a nice IDE, Web Server, Debugger, Database, etc, on a single install image (*.msi or *.exe)?
This of course would be completely opposite of Eclipse PDT, which requires you to search and locate a bunch of additional components which never quite work together.
I think you should go for a separate install for server (web, database) and one for development (IDE, debug) -> Zend or PHPed ?
I think the question is: Does there need to be a true all-in-one solution? I think not.
I agree it's bothersome to have to put dozens of pieces together, but I find a combination of XAMPP, the IDE of my choice, and a few additional bells and whistles (like Polystyle for source code formatting) totally flexible, and not too much work to install.
I don't know if you'll find all of what you're looking for in one package for Windows, but you can get it narrowed down to about two...
XAMPP for Windows comes with: Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, Ming, JpGraph, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, and WEB-DAV + mod_auth_mysql.
Then you just need an editor with a debugger, which there are many choices, mostly non-free, such as NuSphere's PhpEd - or free - such as Eclipse PDT or gVim+XDebug+DBGp client.
True one-in-all - not yet. Maybe someone reading this will upload a version.
My tip would be:
XAMPP and Netbeans (The PHP bundle).
2 clicks to install.
3 clicks if you don't have java installed already.
Netbeans is a nice IDE for PHP, too. I use it all the time and I'm much more satisfied with than with Eclipse PDT. It comes in one neat bundle, that you can just install and use right away.
Just download the PHP bundle here
As for a web server, I can recommend XAMPP or Zend Server. They are both easy to install and do a good job. XAMPP has MySQL on board while Zend Server has some really cool optimization features for great performance.
Should it be a requirement that your development environment is easy to install? You're a developer so, you should be able to install and configure a set of (more powerful) tools that suit your specific needs.
You'll only install your bundled IDE once (every so often) so that feature no longer is of benefit when you're developing your projects. It's more likely to become a hindrance as you struggle to configure your environment.
Take a look at Komodo IDE also.
If you're on windows you can get a WAMP package for web,php,database. For IDE I do like Zend Studio 5.5. Not their latest interation based off of PDT. 5.5 has a nice debugger and a built-in web browser that you can view output. The interface is pretty fast, running your code through the debugger/browser is slower than on a real webserver, but ofcourse you get the nice perks of breaking,inspecting your code. The only drawback is that Zend Studio 5.5 is not supported anymore and the highest PHP version that works with it is 5.2.13.
Currently though I have a Virtualbox Ubuntu Server image that mirrors my production enviroment, except it has Samba installed so I can easily copy files back and forth.

PHP: Understanding code via function or file tracing (without XDebug)

I have inherited a moderately large PHP codebase. In order to better understand how it works, I'd like to be able to print to logs a function or file trace whenever I hit a page, so I can correlate pages with source code. Are there any tools I can install? I have root on the server, and so have the ability to install anything as far as Apache or PHP add-ons goes.
I have heard about XDebug, but when reading up on installation, I've discovered that it is not compatible with Zend Optimizer. Unfortunately, this codebase requires Zend Optimizer, so XDebug does not appear to be an option for me at this time.
I'm developing under Linux.
Pisto,
running such tools would probably degrade the performance of your webserver anyway so you shouldn't do that on your production server. So I would advice you to copy the code on a different server disable Zend Optimizer and use Xdebug there.
Zend also provide their own debugging extension Zend debugger may be it work with the Zend optimizer.

Remote Debugging PHP Command Line Scripts with Zend?

I'm using Zend Studio to do remote debugging of my php scripts on a dev server. It works great for web code, but can I make it work with command line scripts?
I have several helper apps to make my application run. It would be really useful to fire up the remote debugger through command line instead of a web browser so I can test these out.
I assume it's possible, since I think Zend is using xdebug to talk to Eclipse. Apparently, it adds some parameters to the request to wake the Zend code up on a request. I'm guessing I'd need to tap into that?
UPDATE
I ended up using xdebug with protoeditor over X to do my debugging.
I was able to get remote CLI debugging working in Eclipse, using xdebug, though I've not tried it with the zend debugger. I would assume this should work the same with ZSfE, if that's the "Zend Studio" you're using.
Since this is more along the lines of product support, your best bet is probably emailing the support people. We bought Zend Studio at my last job and they were always able to help us in a matter of hours.
Feel free to post the answer though, I am sure there are more people looking for it. :)
There's an option to debug a php script,
run->run as->php script
I believe it also has to be in your project root though. Just for clarification, Zend studio uses their own debugger, while the eclipse pdt project you have the option for Xdebug or Zend's debugger.
Haven't tried, but you can set the QUERY_STRING environment variable to the one that toggles the Zend debugger on.
Per this article.
export QUERY_STRING=start_debug=1&debug_host=<host name or IP of the local machine>&debug_port=<the port that is configured in your ZDE settings>&debug_stop=1
And then run the CLI script.
Remote command-line debugging is possible, I just tried it.
In my case I used Zend Studio + Zend Debugger.
This official article here by the Zend people will help you out, it's what I used. It explains all the parameters that must go into the shell command.
Make sure that you have the php.ini properly set on the remote server, and that it allows your IP address and it will work.
Also, you don't need to export the QUERY_STRING variable.
You can just do:
QUERY_STRING="start_debug=1&debug_host=[127.0.0.1]&no_remote=0&debug_port=10137&debug_stop=0" /path/to/php/binary /your/php/script.php
Running that on an SSH shell will light up your Zend Studio. Sweet!

Categories