Our blog

 

Setting up a 64bit Linux PHP Development Enviroment

This is a guide to setting up a PHP web development environment on a 64 bit Linux. I have used this on Ubuntu Intrepid 64bit and also Open Suse 11.1 64bit.

Install XAMPP
To get the ball rolling nice and quickly I have installed XAMPP for Linux which is available here. Then the first thing to do once XAMPP is running is to run the security wizard to set passwords etc.

It is possible to download all the LAMP components using your particular Linux package manager, however I like XAMPP because it is the same no matter which flavour of Linux you install it on, its set up to be a development environment rather than a production server and is generally nice and easy to use. It comes bundled with phpMyAdmin as well and requires no configuration to get up and running.

XAMPP Control Panel
A nice easy way to start, stop and restart all or some of the LAMPP services is to set up the control panel. XAMPP comes bundled with a python control panel, however you will need to manually create a shortcut to load the control panel.

Create an application launcher with the command

CODE:
  1. gksudo python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py

Xdebug
I want to get xdebug working so I have been following some instructions I found here

In order to get these instructions to work, I had to first install autoconf. I used Syntaptic Package Manager (System->Administration->Syntaptic Package Manager) and then searched for autoconf.

Then it turns out that as I am running 64bit, the xdebug.so I have just made won't work. Thankfully it turns out its possible to download a precompiled 32bit xdebug.so file from here.

You can download this file and whack it into your /opt/lampp/lib/php/extensions folder. (Note for Open Suse I have installed this root menu extension which helps in editing or moving things around as root without having to open the terminal.)

Next you need to add the following line to the bottom of your php.ini file (located in /opt/lampp/etc/php.ini):

CODE:
  1. zend_extension=/opt/lampp/lib/php/extensions/xdebug.so
  2. xdebug.remote_enable=On
  3. xdebug.remote_host="localhost"
  4. xdebug.remote_port=9000
  5. xdebug.remote_handler="dbgp"

Then to check if its all working, go to http://localhost/xampp/phpinfo.php and you should see a message like "with Xdebug v2.1.0-dev, Copyright (c) 2002-2008, by Derick Rethans".

Eclipse
Found some excellent tutorials on setting up Eclipse here, including instructions on getting the JRE working properly and also linking it up to Xdebug. The tutorial isn't based on an XAMPP setup though but should be easy enough to apply to my situation.

Another tutorial that is useful is this one and also this one

Once Eclipse is installed you will need to tweak the settings so that it can find the correct PHP executable and is set to use the xdebug extension for debugging.

Eclipse creates a folder called a workspace, which is where all the project files are stored. Its handy to make the workspace accessible to Apache and the easiest way to do this is to create a symbolic link from the htdocs folder in you lampp directory to the home/user/workspace folder.

More...

More Reading:

4 Comments

Wil Sinclair
April 3rd, 2009

OOC, have you tried installing the Zend Server 64-bit Linux Debs or RPMs? If so, how does it compare to the method above?

 

admin
April 6th, 2009

no not as yet..

this article was actually written before they were released but I never got round to finishing it up and publishing it until recently.

I would be interested in seeing how it works out, but for now I have a reasonable set up though I have dropped eclipse in favour of netbeans as I find it is much less sluggish and seems generally a bit more stable.

 

Doru
July 4th, 2009

I prefer the distribution's packages (Ubuntu 9.04), as it is very easy to update everything, or replace different componets (ex. replace apache with lighttpd). Also, there is a php5-xdebug package for 64bit in the Ubuntu repos, which to be honest I trust more than something compiled by other people.
In Ubuntu there are a couple of slick commands like a2enmod/a2dismod, a2ensite/a2dissite which make your life easier when you need to add anew vhost or enable/disable an Apache module.
I have also created a small graphical tool for dealing with these commands.
For database development I use the mysql-administrator, mysql-query-browser and mysql-workbench which, in my oppinion are far more superior tools than phpmadmin.
For editig code I use Komodo Edit; I like this one because it is built on the Mozilla platform, and it has the same extensions mechanism as Firefox has.

Cheers.

 

admin
July 21st, 2009

nice tips

yes the mysql admin, query browser (both available in the repos) and workbench (available as a Deb from MySQL http://dev.mysql.com/workbench/) are nice tools and a good alternative to phpMyAdmin

Haven't tried out Komodo Edit - have since this article settled on Netbeans as my IDE of choice

 

 

Leave a Reply