Zend Studio, as you all must be aware, is a full featured PHP IDE. It does require a little setup so your Run/Debug experience is painless (after all, that is the true reason for using an IDE!).
The following assumptions are made:
1. You are running a linux OS
2. You already have a (working) LAMP setup on your workstation (http://localhost takes you to the homepage)
Here’s the process I used to setup zend studio on my system:
1. Download Zend Core. This is REQUIRED for setting breakpoints and debugging web pages. Select “Zend Core V2.5(Win/Linux)”.. Be sure to select either 32 bit or 64 bit depending on the version of OS/apache2 installed.
Install the software (I prefer to be in “su” mode for all install operations).. Copy the downloaded tar file to the /opt directory. Then, run the following commands to install it..
root@ubuntu:/opt# tar -zxvf ZendCore-2.5.2-linux-glibc23-amd64.tar.gz
root@ubuntu:/opt# cd ZendCore-2.5.2-linux-glibc23-amd64
root@ubuntu:/opt/ZendCore-2.5.2-linux-glibc23-amd64# ./install -g
the “-g” option does a graphic install.. Please refer to the instructions (pdf) in the downloaded file. I selected the “Modify apache” option only. You do not require any other components installed.
You will be prompted for the location of apache on your computer. For some reason, the installer could not autodetect my main web folder (/var/www).. I entered it into the text field provided. A new directory /usr/local/Zend will be setup with appropriate directives in the apache2.conf file.
2. Download and Install Zend Optimizer. Be sure to select the 32/64 bit version depending on your OS. Zend Optimizer enhances the running speed of php apps. The ZendCore front-end requires this to be installed. Since it is free, we do not complain!
Copy the download file over to the /opt directory
Uncompress/extract the file (tar -zxvf same as in step 1)
Navigate into the directory that is created
Run the install script by using “sudo ./install”
You will be prompted for the location of apache, php.ini file etc (it is a graphic installer).. finally it comes back with a confirmation that the setup is complete.
Now, you should be able to navigate to http://localhost/ZendCore and view your server in GUI goodness. Running phpinfo() should display the Zend Optimizer as being installed like so:
3. Now, onto the task of actually setting up Zend Studio. By default, the ZS sets up a default workspace in your home directory:
Projects that you create will be created in subfolders under this directory. Now, open up Zend Studio and create a new php project (file->new->PHP project). Give the project a name (phptest) and accept the default workspace.
Create a new php file inside the project (right click on project, New->php file).. Name it index.php
Put the following lines in index.php.. It simply displays the php setup on our system:
We are ready to test/run/debug our sample application. Before we can do that, we need to make the directory accessible from the web directory. The easiest way to do that is to open the file browser by typing “sudo nautilus” on the console window, navigating to the phptest folder, right clicking and selecting the “Make link” like so:
This action will create a symbolic link to this folder in the same subdirectory. Go ahead and copy this folder link to the /var/www folder (this is the default web folder setup once apache is installed. Rename the sym link to “phptest“.
Thats it! Now, we are ready to run our php file within the Zend framework.. Click on the “Run” button.. Select “PHP web page”
Next, you will be prompted for the Launch URL which in this case is http://localhost/phptest. You should now be able to run any php web app (including Zend Framework applications), set breakpoints, watch variables etc..