Apache2 and PHP5
Remove the default installation of Apache2 and PHP5 from Synaptic if they exist. They set up the Apache files in a different way as standard, which makes development trickier, especially cross-platform.
Install Apache2
Download the latest stable version of Apache. In my case this was "httpd-2.2.6"./configure --prefix=/usr/local/apache2 --enable-rewrite=shared
make
sudo make install
Install PHP5
Download the latest stable version of PHP. In my case it was "php-5.2.5"
For MySQL, I decided not to install it manually in this case (I had databases already in the one installed), but I needed to make sure libmysqlclient15-dev was installed for the configure command to work. I installed it manually on another system, and ended up using the path: /usr/local
Optional: for the gd, png-dir and jpeg-dir options to work (which I required for gallery code), you will need to install libpng and libjpeg devs - synaptic will install into the directories given in the command below.
Mbstring was also added, because many things use it - and significantly, MySQL does.
./configure --with-config-file-path=/usr/local/lib/php --prefix=/usr/local --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/bin/mysql --enable-exif --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/ --with-gd --enable-mbstring
make
sudo make install
Note: with these installs, they create a script called "config.nice" which can be used to rerun the configure command with the last used parameters. This is useful if you need to add a module and recompile, or decide to make a change.
Note: when I first tried it it failed because I was missing libxml-dev, which I installed normally with Synaptic. It might also fail if there were problems from a previous install attempt, and you can use the command "make clean" which helped me in one instance where I was getting an error.
Change the Apache settings
cd /usr/local/apache2/conf
I used the following because I was testing other settings, and it helped me get it running. Change it back to root when done:
insecure - do not use on a live environment: sudo chown -R username *
sudo gedit /usr/local/apache2/conf/httpd.conf
In httpd.conf:
Uncomment the Include line after:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
This allows you to create the virtual hosts using /usr/local/apache2/conf/extra/httpd-vhosts.conf
Edit ServerName to be:
ServerName 127.0.0.1
This gets rid of the error I was getting every time Apache started.
Enable PHP in Apache (I added it at the end of the "LoadModule" section with:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
PHPIniDir "/usr/local/lib/php"
Copy php.ini-dist to /usr/local/lib/php/php.ini
Start the server:sudo /usr/local/apache2/bin/apachectl start
Stop the server:sudo /usr/local/apache2/bin/apachectl stop
Restart the server:sudo /usr/local/apache2/bin/apachectl restart
MySQL
Downloaded the tar.gz from Source Downloads on: http://dev.mysql.com/downloads/mysql/5.0.html#downloadsI pretty much followed the directions from here:http://www.unixcities.com/mysql/index.html
Eclipse with Zend Debugger
Get the latest Zend server debugger from: http://downloads.zend.com/pdt/server-debugger/
And the latest Zend PDT Eclipse version from: http://downloads-source.zend.com/pdt/all-in-one/
Extract the Zend debugger file - in my case ZendDebugger.5.2.12-linux. Previously I installed php 5.2, so go in to the 5_2_x_comp folder and copy it to "/usr/local/lib/php/extensions"
Edit /usr/local/lib/php/php.ini and add the lines:
; Zend Debugger
zend_extension_ts=/usr/local/lib/php/extensions/ZendDebugger.so
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always
Remember to copy dummy.php to the root of your server. Check to see if the zend section is added to phpinfo();
Restart Apache:
sudo /usr/local/apache2/bin/apachectl restart
Virtual servers:
Add entries into /usr/local/apache2/conf/extra/httpd-vhosts.conf for each of your sites. Here is a sample:
<VirtualHost *:80>
ServerName phpmyadmin
DocumentRoot /usr/local/apache2/htdocs/phpMyAdmin
DirectoryIndex index.php
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName testsite
DocumentRoot /home/alex/www/testsite/
<Directory /home/alex/www/testsite/>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Notice that I added phpMyAdmin into the standard web-server area, and I also left the permissions to read-only for all standard users. However, because this is for testing only, I put my test site in to my home directory. This means that I can easily mess around with it, and I know it will back up when I make a back-up of my home directory.
To get browsers to recognise the settings, you will also need to edit the /etc/hosts file:
$gedit /etc/hosts &
and add the name of the site for each of your virtual servers:
127.0.0.1 localhost phpmyadmin testsite
You can add as many sites to this list as you like.