Getting 32 bit ZendStudio Debugger to work with 64 bit Apache2 - PHP using MacPorts on Leopard

Bill Hernandez ms at mac-specialist.com
Tue Apr 29 21:05:35 PDT 2008


If you have tried to get ZendStudio Debugger to work with MacPorts on  
Leopard, this may help. It took me several weeks off and on to get it  
running ...

Here's the problem I kept running into, and below is the solution :

Apache2 Error Log
----------------------------------------------------------------
[info] Init: Seeding PRNG with 144 bytes of entropy
[info] Init: Generating temporary RSA private keys (512/1024 bits)
[info] Init: Generating temporary DH parameters (512/1024 bits)
[debug] ssl_scache_dbm.c(408): Inter-Process Session Cache (DBM)  
Expiry: old: 0, new: 0, removed: 0
[info] Init: Initializing (virtual) servers for SSL
[info] mod_ssl/2.2.8 compiled against Server: Apache/2.2.8, Library:  
OpenSSL/0.9.7l
[info] Init: Seeding PRNG with 144 bytes of entropy
[info] Init: Generating temporary RSA private keys (512/1024 bits)
[info] Init: Generating temporary DH parameters (512/1024 bits)
[debug] ssl_scache_dbm.c(408): Inter-Process Session Cache (DBM)  
Expiry: old: 0, new: 0, removed: 0
[info] Init: Initializing (virtual) servers for SSL
[info] mod_ssl/2.2.8 compiled against Server: Apache/2.2.8, Library:  
OpenSSL/0.9.7l

ERROR [01] :
Failed loading /Applications/Zend/ZendStudio-5.5.1/lib/php5/ 
ZendDebugger.so:  (null)

[notice] Digest: generating secret for digest authentication ...
[notice] Digest: done
[notice] Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.7l DAV/2 PHP/ 
5.2.5 configured -- resuming normal operations
[info] Server built: Feb 20 2008 12:01:56
[debug] prefork.c(991): AcceptMutex: flock (default: flock)
[debug] proxy_util.c(1670): proxy: grabbed scoreboard slot 0 in child  
79 for worker proxy:reverse
[debug] proxy_util.c(1778): proxy: initialized single connection  
worker 0 in child 79 for (*)
----------------------------------------------------------------

I originally purchased ZendStudio 4.x.x, and was never able to get it  
to work.  I eventually gave up dealing with Zend Support, and about a  
year later when ZendStudio 5.x.x came out I upgraded, and still could  
not get it to work correctly. Eventually after going back and forth  
with support for several months, I called the admin for the guy in  
charge of Zend USA, and she got someone to help me get it up and  
running.

The ZEND PHP Debugger once running worked fine using OS X 10.4 Tiger  
for about a year and half, but when I upgraded to Leopard and re- 
installed macports using :

shell> ~ $ sudo port -v install sqlite3
shell> ~ $ sudo port -v install postgresql83-server
shell> ~ $ sudo port -v install postgresql83-doc
shell> ~ $ sudo port -v install postgresql83
shell> ~ $ sudo port -v install mysql5 +server
shell> ~ $ sudo port -v install php5 +apache2 +fastcgi +tidy +mysql5  
+postgresql83 +sqlite +ipc +pcntl +pear +readline +sockets

Once I got all these installed and configured, I kept getting the  
error above telling me that 'ZendDebugger.so' was not loading causing  
the ZEND PHP Debugger to break. Once again I posted messages to Zend  
Support, and after about a month I finally got some help. I did the  
same as before, I called the admin for the guy in charge of Zend USA,  
once again she got someone to help me and within a few days he pointed  
me to http://www.zend.com/forums/index.php?t=msg&goto=15690.

--------------------------------------------------------------------------------------------------
Here's what is required to get ZendStudio Debugger to work using  
MacPorts :
--------------------------------------------------------------------------------------------------

ZendDebugger.so  -----------> for debugging localhost stuff
ZendDebuggerLocal.so  -----> for debugging remote servers

Install ZendStudio_5.5.1 via a dmg from the Zend site.

If you want to debug php code running on Apache2/PHP on your own  
machine in LOCALHOST mode, you will have to download :

'ZendDebugger-5.2.12-darwin8.6-uni.tar' which contains:

 > 4_3_x_comp
 > 4_4_x_comp
 > 5_1_x_comp
 > 5_2_x_comp
     ZendDebugger.so

or you can also copy it from ZendPlatform if you have that.

Copy 'ZendDebugger.so' from the folder containing the php version you  
are using. In my case I have php v5.2.5, so I copied '../5_2_x_comp/ 
ZendDebugger.so' to '/Applications/Zend/ZendStudio-5.5.1/lib/php5/' so  
that you end up with :

[2008.29.04](10:00PM) -> [username] ~ $ ls -ls /Applications/Zend/ 
ZendStudio-5.5.1/lib/php5/
total 4928
4384 -rwxrwxr-x  1 username  admin  2244316 Dec 13 07:11 ZendDebugger.so
  544 -rwxrwxr-x  1 username  admin   274756 Dec  2 08:38  
ZendDebuggerLocal.so

Make sure you do a :

shell> chmod -R 775 /Applications/Zend/ZendStudio-5.5.1/lib/php5

Unfortunately Leopard is running Darwin 9.2.2, and  
'ZendDebugger-5.2.12-darwin8.6-uni.tar' was compiled using Darwin 8.6.

I had noticed this problem and mentioned it in the emails I sent to  
Zend Support, emails that went unanswered for quite a while until I  
called the company and got someone there involved again.

------------------------------------
Some clever guy by the name of 'Kevin Ashbridge' had posted a message  
about replacing the Leopard Apple installed PHP with the one from  
Entropy at http://www.zend.com/forums/index.php?t=msg&goto=15690 and I  
got enough out of it to solve the problem.

He pointed out in step ( 5 ) :

5. Finally - and here's the secret - restart your web server in 32-bit  
mode using the following command:

sudo arch -i386 /usr/sbin/httpd
------------------------------------

I had no idea that 64 bit Apache2 could be run in 32 bit mode, but  
apparently it can...

Obviously for MacPorts we will use something different.

/opt/local/etc/php.ini       needs the following three lines added at  
the end.

zend_extension=/full/path/to/ZendDebugger.so
zend_debugger.allow_hosts=<ip_addresses>
zend_debugger.expose_remotely=always

Here's a couple of examples on how to use 'zend_debugger.allow_hosts' :

;	zend_debugger.allow_hosts=127.0.0.1/32
;	zend_debugger.allow_hosts=127.0.0.1/32, 192.168.37.1/24,  
192.168.38.1/24, 192.168.39.1/24, 172.16.35.1/24

-------------------------------------------------------------------------------
SHUTDOWN APACHE2 :
-------------------------------------------------------------------------------
shell> ~ $ sudo /opt/local/apache2/bin/apachectl stop
shell> ~ $ ps aux | grep httpd

-------------------------------------------------------------------------------
RESTART THE 64 bit APACHE2 using the 32 bit mode ( 'arch -i386' ) :
-------------------------------------------------------------------------------
shell> ~ $ sudo arch -i386 /opt/local/apache2/bin/apachectl start
shell> ~ $ ps aux | grep httpd


Now ZEND Debugger will work...

Launch 'Zend.app'  which lives at    '/Applications/Zend/ 
ZendStudio-5.5.1/bin/ZDE.app'

You can then go to the 'Tools --> Debug URL' menu item and type :

http://localhost/some/path/to/some/file.php

and the debugger should work like a champ...

Hope this is useful...

Bill Hernandez
Plano, Texas




More information about the macports-users mailing list