Zend Studio


Windows 7 cannot select default program – not working 1

Suddenly today my files lost association to the proper program (zend studio) on my windows 7 machine. I right clicked the file and chose “open with” and navigated to the program, double clicked it. Unfortunately the program never got added to the list of recommended or available programs in the previous window, so I could not assign it as the default program. However, I was able to navigate to other programs and assign them as the default, so the problem existed with the program I was trying to select. I believe there was an issue with the registry keys related to this program. I ended up running the program installer again and doing a “repair” and then it worked.


Zend Studio debugger doesn’t work on Magento

Learning Magento is hard enough and when you’re debugger won’t stop at any breakpoints, that’s enough to take any developer out of his game. I was fortunate to find this blog post http://rocinantesoftware.blogspot.com/2009/06/debugging-magento-vista-xampp-zend.html detailing how to configure various debuggers to work with Magento. Below is how to configure your magento project with Zend Studio for Eclipse.

ZEND STUDIO FOR ECLIPSE
The following assumes that Magento can be reached from http://127.0.0.1/magento
– From the “Run” menu, select “Debug Configurations”
– On the left, right-click on “PHP Web Page” and select “New”
– Name: Magento
– Server Debugger: Zend Debugger
– PHP Server: Click on the “New” link
– Name: Magento Server, URL http://127.0.0.1 (do NOT use localhost – I don’t have notes on this, but I’m sure that I had trouble accessing the admin area using local host, and switching to http://127.0.0.1 fixed the problem).
– Hit next, going to the Server Path Mapping, and “Add”
– Path on Server: the windows path to your magento dir, e.g. C:\Users\Ed\workspace\magento
– Path in Workspace: /magento
– Click Finish
– Now back in the “Debug Configurations” dialog, set file to magento/
– uncheck “Auto Generate (URL)”, and set the path (first part of which is auto-generated) to /magento
– In the “common” tab, click “run” and “debug” for showing in the favorite menus.

Also, for me personally I had to edit the php server and clear out the “Local Web Root” input and on the “path mapping” tab ensure you have one entry – the “path on server” should be the full directory path to your application and the “local path” should be the name of your zend studio project, such as “/magento”.


Zend Studio Magento Building Workspace Error

I encountered a very large project involving Magento and added it as a project to my zend studio. Zend studio would frequently hang with an error related to building workspace. As I suspected, the problem was related to running out of memory as this project is huge. I increased the memory available to Zend Studio with the below solution.

In the Zend Studio interface it is possible to monitor how much Java heap space is used by the application. To do so, enable the option Show heap status in the Zend Studio Preferences by going to Window | Preferences | General (in MacOS X go to Zend Studio | Preferences | General). The heap status now appears in the application’s status bar. If you see that you quickly run out of memory (for example during a project build) you should consider increasing the default Java heap size. This can be done in the file ZendStudio.ini located in the Zend Studio installation path. Search for the –Xms and –Xmx parameters:

Xms – The initial amount of memory to allocate for Java heap space.
Xmx – The maximal amount of memory that is allowed to be used for Java heap space.

These values can be increased, but be aware that you are limited by the physical RAM of the system. Even for very complicated projects 512M Xms and 1024M Xmx should be enough.


Zend Studio php_pdo_mysql.dll error

I started using phpunit, which is built into Zend Studio 7.2. Everything works fine until it encountered a database query that used PDO. The test case will timeout and zend studio will give you the error “Test case was unexpectedly terminated”. It took a lot of digging to find the real error in the windows event viewer:

Faulting application name: php-cgi.exe, version: 5.2.10.10, time stamp: 0x4abb41d8
Faulting module name: php_pdo_mysql.dll, version: 5.2.10.10, time stamp: 0x4ab23077
Exception code: 0xc0000005
Fault offset: 0x00002580
Faulting process id: 0x458
Faulting application start time: 0x01cb16fb91818916
Faulting application path: C:\Program Files (x86)\Zend\Zend Studio – 7.1.0\plugins\org.zend.php.debug.debugger.win32.x86_5.3.7.v20091116\resources\php5\php-cgi.exe
Faulting module path: C:\Program Files (x86)\Zend\Zend Studio – 7.1.0\plugins\org.zend.php.debug.debugger.win32.x86_5.3.7.v20091116\resources\php5\ext\php_pdo_mysql.dll
Report Id: d31816ab-82ee-11df-99ae-00241dd93279

The solution? While I had Zend Server installed and using PHP 5.3, Zend Studio’s internal version was using PHP 5.2.xxx. I’m pretty certain Doctrine, which uses PDO, requires PHP 5.3. I changed Zend Studio to PHP 5.3 and it worked. In Zend Studio, go to Window->preferences->php->debug and ensure the “PHP executable” is set to PHP 5.3. FYI – My “server” on this screen is set to “Local Zend Server”. Hope this helps!