![]() |
John VanDyk has been innovating with information technology for more than 20 years. Read more... |
Zend Studio 5.5 debugging on OS X via Ubuntu and Parallels
Here's how to get debugging working in Zend Studio Server 5.5 for the Mac. There is no native version of Zend Platform for OS X on Intel Macs yet, so this solution uses Ubuntu on Parallels as an interim solution.
Installing Ubuntu on Parallels
I downloaded Ubuntu 6.10.
In Parallels, new virtual machine, typical installation.
Guest OS Type: Linux.
Guest OS Version: Debian Linux.
Called the Virtual Machine "Ubuntu".
Uncheck "Start guest OS installation".
Clicked on CD/DVD-ROM and changed the Emulation from Use CD/DVD-ROM to Use image file.
Pointed the image file to ubuntu-6.10-desktop-i386.iso
Blicked on Options, then Booting Options.
Changed Boot sequence to have CD-ROM boot first.
Started virtual machine which booted off the image file.
Pressed enter to boot from LiveCD.
Selected U.S. English.
Selected "Erase entire disk".
After installation, selected "Continue using LiveCD"
Powered off virtual machine.
Changed boot sequence to have hard disk boot first.
Booted and logged in.
System - Preferences - Screensaver Preferences, uncheck Activate screensaver.
Tested network connection.
Installing Apache, PHP, and Samba
You can use either the command line or Synaptic Package Manager to install software. If you use Synaptic:
System - Administration - Synaptic Package Manager
Settings - Repositories, check Community maintained Open Source software
I used the command line:
sudo bash
apt-get update
apt-get install apache2-mpm-prefork apache2 libapache2-mod-php5 php5-mysql smbfs
Mounting OS X Filesystem on Ubuntu
Now Apache and PHP are installed. Next, I wanted to mount my OS X filesystem on Ubuntu.
Started Windows File Sharing on OS X.
Firewall, chose New... and selected SMB (without netbios) (445 TCP).
Made the following addition to /etc/smb.conf on OS X (xxx.xxx.xxx.xxx is the IP of the Ubuntu virtual machine).
; allow connections only from the VM
hosts allow = xxx.xxx.xxx.xxx
; verbose logging in /var/log/samba/log.smbd
log level = 3 passdb:5 auth:10 winbind:2
; share my Sites folder
[sites]
path = /Users/john/Sites
read only = no
browseable = no
comment = Websites
And I commented out the [homes] section because I'm paranoid.
Now I went to Ubuntu's terminal to mount the share:
mkdir /home/john/sites
mount -t smbfs //my.mac.ip.address/sites /home/john/sites -o username=myosxusername
I tested and doing ls
gave me a list of the files in /Users/john/Sites. OK so far.
Serving my Sites directory via Ubuntu
Now I want Apache to serve out of /home/john/sites instead of the default /var/www. (I have no other use for Apache on this VM, so I'm editing the default settings.) So in Ubuntu I said
nano /etc/apache2/sites-enabled/000-default
When I was done it looked like this:
<VirtualHost *> ServerAdmin my@email.address DocumentRoot /home/john/sites <Directory /home/john/sites Options Indexes FollowSymLinks MultiViews AllowOverride All Order deny,allow deny from all allow from 127.0.0.1 allow from my.mac.ip.address </Directory> ...
I restarted Apache with apache2ctl restart
.
I made a little file called test.php with just <?php phpinfo(); ?>
in it. Going to http://xxx.xxx.xxx.xxx/test.php showed the PHP info page. So Apache and PHP are now running.
Installing Zend Platform on Ubuntu
Now it's time to install Zend Platform. I downloaded it from Zend and installed it on Ubuntu:
tar -xvf ZendPlatform-3.0.0Beta-linux-glibc21-i386.tar.gz
cd ZendPlatform-3.0.0Beta-linux-glibc21-i386/
bash ./install
Note that you need to type bash ./install
instead of ./install
because /bin/bash is really /bin/dash on Ubuntu.
I accepted all the defaults except on the WEB SERVER SETTINGS page, where I entered /home/john/sites in the htdocs field.
I did the Express option. It took several minutes and then completed.
On Ubuntu I started Firefox and went to http://localhost/ZendPlatform and logged in. Only localhost is allowed to do debugging and profiling sessions by default, and I wanted to do that from my Mac (that's sort of the whole point of this exercise!). So I clicked on Configuration and added my host to Allowed Hosts.
Configuring Zend Studio 5.5
Now I needed to configure Zend Studio 5.5 on my Mac to use Ubuntu. In Zend Studio, I added the IP of the Ubuntu virtual machine to Tools - Preferences - debug.
One final step: the debugger on Ubuntu connects back to Zend Studio on the Mac via port 10000. So I opened that port on my firewall.
To test, I chose Tools - Test Debug Server Connection and it reported success.
Conclusion
I now have a single filesystem that I can access via normal HTTP by issuing a request to my Mac, or via debugging by using Zend Studio to issue a debugging request via Ubuntu.
Drupal ninjas will notice that I haven't installed MySQL on Ubuntu. That's because I'll configure the site-specific Drupal settings file to point to the MySQL on my Mac. One database. One filesystem. Two Apache/PHP installs. Sweet.
Note: after trying this for a bit, it seems that Zend Platform's "Dynamic Content Caching" causes Apache/2.0.55 PHP/5.1.6 to segfault. Turning it off in the Zend Platform control panel at Performance - Settings -Dynamic Content Caching made the problem go away.
Update: after more investigation, it turns out that the segfaulting is due to the Zend Optimizer. Commenting out the following line in /usr/local/Zend/Platform/etc/php.ini eliminates the segfaults:
zend_extension_manager.optimizer=/usr/local/Zend/Platform/lib/Optimizer-3.2.0
- Log in to post comments
Comments
Regarding "/bin/bash is really /bin/dash"
On recent Ubuntu releases, /bin/bash is actually a GNU bash but /bin/sh is not. /bin/sh is provided by dash, that's why some shell scripts fail to run if their shebang line calls /bin/sh. Either the shell script in question uses some non-POSIX features or other non-portable features like "echo -e".
See also https://wiki.ubuntu.com/DashAsBinSh