1.4.6 Build 488

visual editor for ORM frameworks

Pricing information Free download

Installing Ubuntu Server with Zend Server CE in VirtualBox Part 2/2

As I mentioned in one of previous articles we are developing under Windows with virtualized Linux server. In this article I will install step by step VirtualBox with Ubuntu Server 9.10 and Zend Server Community Edition with Zend debugger.

Previous part summary

In first part of this article we installed VirtualBox on Windows host and install Ubuntu Server with VirtualBox guest additions.

Install Zend Server CE

Instead of standard LAMP combination I chose Zend Server Community Edition. It's a certified PHP distribution with all most used extensions packed with Apache and MySQL. Here are some advantages you have with Zend Server CE:

  • Zend Debugger out of the box
  • User friendly administration web interface for Apache and PHP configuration
  • PHP 5.3 support
  • If you have Zend Server on your production server you have unified environment both for production and development

Update: It seems it is better to install MySQL server first as there are troubles if the MySQL server is installed after Zend Server CE:

sudo apt-get install mysql-server

Now back to installing Zend Server CE. Open /etc/apt/sources.list and add

deb http://repos.zend.com/zend-server/deb server non-free

at the bottom of the file. Run these commands to add repository key and install zend server with extensions:

wget http://repos.zend.com/deb/zend.key -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install zend-server-ce-php-5.3
sudo apt-get install php-5.3-extra-extensions-zend-server-ce

The last line is to install some additional extensions you might need. Here are more information about installing Zend Server CE.

Update: You will also need Zend Server CE php executables added to your profile paths. At the end of ~/.bashrc add following line:

PATH=$PATH:/usr/local/zend/bin

Mount windows project folders

To mount permanently windows project folders edit /etc/fstab and add last line:

public_html     /mnt/public_html vboxsf defaults                 0       0

to mount the disc for the first time run:

sudo mkdir /mnt/public_html
sudo mount /mnt/public_html

You have to run these commands only once, folders will be mounted automatically after each restart.

Configure Apache

If you now connect to localhost, you should see "It works!" page. First we change apache document root. Open file /etc/apache2/sites-enabled/000-default and edit line DocumentRoot /var/www to:

DocumentRoot /mnt/public_html

I am used to have each project set as virtual server. You can choose any of your current projects, I will show it on ORM Designer site. Create new file in /etc/apache2/sites-enabled and call it for example 001-orm-designer. You can use any name you want all configurations from /etc/apache2/sites-enabled are loaded. Open your configuration and add following lines:

<VirtualHost *:80>
  ServerName orm-designer
  DocumentRoot /mnt/public_html/orm-designer/web/
  EnableMMAP Off
  EnableSendfile Off
</VirtualHost>

EnableMMAP and EnableSendfile directive must be turned off because we are fetching files from windows file system and you would be facing upredictable results if you don't turn it off. You should also edit your windows hosts file located in c:\windows\system32\drivers\etc\hosts. If you can't see this file or folders run this command:

notepad c:\windows\system32\drivers\etc\hosts

and add following line to the file:

127.0.0.1       orm-designer

restart Apache server:

sudo /etc/init.d/apache2 restart

Install and configure MySQL

Install MySQL

You can install MySQL with phpMyAdmin:

sudo apt-get install phpmyadmin-zend-server

or MySQL alone:

sudo apt-get install mysql-server mysql-client

Configure MySQL

There is little that needs to be set up in MySQL. By default the socket is in /var/run/mysqld/mysqld.sock, but you might see Doctrine_Connection_Exception with message Can't connect to local MySQL server through socket '/tmp/mysql.sock'. To avoid these troubles, open /etc/mysql/my.cnf and change socket to:

socket = /tmp/mysql.sock

in client, mysqld_safe and mysqld section. In mysqld section change also pid-file to:

pid-file = /tmp/mysql.pid

and restart MySQL server:

sudo /etc/init.d/mysql restart

Configure PHP via Zend Server administration web interface

We have to change default path to MySQL socket. Open Zend Server administration interface http://localhost:10081/ZendServer and set administrator password. Once you are logged in, you will see there are plenty of options to configure. Go to Server Setup -> Directives and search for socket, you should see mysql and mysqli sections found. Change path to:

/tmp/mysql.sock

save changes and restart server (green button at the bottom of the page). Now you should be able to log into http://localhost/phpmyadmin/ and create your projects database. Now you should be able to see your project's site, in my case http://orm-designer/frontend_dev.php.

Zend Debugger in Eclipse PDT

Now we are almost ready. Site is running, database is ready and only thing missing is debugger. I am using Eclipse PDT IDE which I found closest to my developer's needs. Go to debugger configuration as seen bellow.

Create new configuration and create new PHP Server.

And select file and set path for debugging.

Click debug to check if the debugger is working. You should see something similar to the screen bellow.

Troubleshooting

You might find yourself facing some troubles after your computer comes from hibernation or is restarted. Bellow are some troubles you might find.

You can't connect to virtual machine through putty

The problem is probably with the connection. Login to the virtual machine through VirtualBox screen and run this command:

sudo /etc/init.d/networking restart

or if it doesn't help:

sudo rm /etc/udev/rules.d/70-persistent-net.rules
sudo /etc/init.d/networking restart

You don't see you windows folders mounted

This sometimes happen if Ubuntu Server is upgraded or it could happen if VirtualBox is running while computer is being hibernated. You have to reinstall Guest Additions. In VirtualBox menu Devices -> Install Guest Additions and run following commands:

sudo mount /media/cdrom
sudo /media/cdrom/VBoxLinuxAdditions-x86.run
sudo reboot

Short summary

I hope you enjoyed this article. If you would like to keep track of other symfony tutorials, you can subscribe to RSS Feed or follow me on Twitter. Next article will describe using ORM Designer external tools feature with virtual Zend Server.

Author: Frantisek Troster

ORM Designer on Twitter

Feed from our blog

Missing field-type icons in ORM Designer

Propel ORM Behaviors support!

Propel ORM validators support!

How to change export format (schema.yml / schema.xml)

How to import model from MySql Workbench

New visual symbols for NULL/NOT NULL column types

Execute another application from ORM Designer import/export script

Forum topics

ORM Designer forum: http://forum.orm-designer.com/

About ORM Designer

ORM Designer is a tool for modelling entity relationship diagrams (ERD). The biggest advantage is full support of any ORM framework which has its definitions stored in a markup language or other structured file.

Currently supported ORMs are PHP Doctrine, PHP Propel and CakePHP frameworks, but more will be added in close future.

Inventic s.r.o. - PayPal verified

Real Time Web Analytics

Clicky

Legal notice: The name CakePHP and the cake icon are trademarks of the Cake Software Foundation Inc., and used with permission. "symfony" is a trademark of Fabien Potencier.

© 2009-2012 Inventic s.r.o. all rights reserved