update: 2010.10.04: upgrading to a newer distro reverted the /etc/hosts file to its default. you’d have to add the name of the clients again.
for php development i use a local php/mysql web server to make dev work a bit faster. these are the steps we followed for a workstation running linux.
extract the downloaded archive with:
sudo tar xvfz xampp-linux-1.7.2.tar.gz -C /opt
note: if you have xampp already installed, the above command will overwrite it. careful.
xampp is now installed in
to start xampp:
sudo /opt/lampp/lampp start
you should see something like this:
Starting XAMPP for Linux 1.7.2...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.
which means the server is ready. i don’t need an ftp server for dev work so i decided to stop proftpd:
sudo /opt/lampp/lampp stopftp
note: issuing the above command will deactivate the proftpd server permanently–it will not start when you start xampp. see the command cheatsheet somewhere below to find out how to reactivate it.
to test our setup fire up your favorite browser and type:
you should see something like this:
you’ll be able to see the status of the installed components, the status of the security of the system, links to documentation and most importantly, detailed information about the server system via phpinfo() as well as database administration panels–phpmyadmin and phpsqliteadmin.
at this point, we have an apache webserver running with php and mysql support.
to stop xampp:
sudo /opt/lampp/lampp stop
|other available parameters for
||Stops and starts XAMPP.|
||Starts only the Apache.|
||Starts the Apache SSL support. This command activates the SSL support permanently, e.g. if you restarts XAMPP in the future SSL will stay activated.|
||Starts only the MySQL database.|
||Starts the ProFTPD server. Via FTP you can upload files for your web server (user “nobody”, password “lampp”). This command activates the ProFTPD permanently, e.g. if you restarts XAMPP in the future FTP will stay activated.|
||Stops the Apache.|
||Stops the Apache SSL support. This command deactivates the SSL support permanently, e.g. if you restarts XAMPP in the future SSL will stay deactivated.|
||Stops the MySQL database.|
||Stops the ProFTPD server. This command deactivates the ProFTPD permanently, e.g. if you restarts XAMPP in the future FTP will stay deactivated.|
||Starts a small security check program.|
and finally, to uninstall xampp:
sudo rm -rf /opt/lampp
warning: this type of server setup is not secure and is not designed for production systems. this server is meant to be part of a web development system accessible only within our intranet which is protected by a dedicated linux-based firewall. don’t be stupid and connect this system directly to the internet.
setting up xdebug
xampp does not come with xdebug so we have to install it separately.
first, install the build-essential package to be used in building xdebug from source:
sudo apt-get update
sudo apt-get install build-essential autoconf
next, we download the development package for the xampp version we are using. in this case its version 1.7.2
sudo tar xvfz xampp-linux-devel-1.7.2.tar.gz -C /opt
then we get to build xdebug:
tar xzf xdebug-2.0.5.tgz
sudo make install
in the last part of the output, you will see something like:
Installing shared extensions: /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/
take note of the directory where the shared extensions are installed. we will need that later.
now, create a subdirectory under /opt/lampp/tmp folder to hold the files generated by xdebug:
sudo mkdir /opt/lampp/tmp/xdebug
sudo chmod a+rwx -R /opt/lampp/tmp/xdebug
for xdebug to work with php we have to edit our php.ini file (
look for a line with “implicit flush” and set it to look like:
implicit flush = On
then add the following lines at the end:
;xDebug Configuration starts
zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.profiler_enable = On
;xDebug Configuration ends
please note that the path of the zend_extension is the same one we noted earlier.
to check if xdebug is talking to php fire up the browser and go to
http://localhost. you should be able to see the following somewhere in the page:
and somewhere near the bottom:
setting up virtual hosts in apache
virtual host is hosting several websites in one machine which is cool when you’re a developer. it certainly make things much easier and simpler than setting up a server for each website.
please make a backup of the files you’re going to edit.
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
/opt/lampp/etc/extra/httpd-vhosts.conf create a virtualhost entry for each server that you’re setting up. it is important that the first virtualhost entry is setup for localhost only. the rest can be for your servers.
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /opt/lampp/htdocs ServerName localhost ServerAlias localhost ErrorLog logs/localhost-error_log CustomLog logs/localhost-access_log common </VirtualHost>
<VirtualHost *:80> ServerAdmin webmaster@client1 DocumentRoot /home/headlessspider/Public/client1 ServerName client1 ServerAlias client1 ErrorLog logs/client1-error_log CustomLog logs/client1-access_log common </VirtualHost>
sudo gedit /opt/lamp/etc/httpd.conf
look for the like containing “httpd-vhosts” and uncomment it–erase the “#” at the start of the line.
in your hosts file
sudo gedit /etc/hosts
edit the line containing
127.0.0.1 localhost and add the name of the additional server so the line would look like:
127.0.0.1 localhost client1
sudo /opt/lampp/lampp restart
and you should be ready to go.