I have decided to finally set up my own dedicated server so i can use it as a test server for several web projects that I am owrking on just now. The helpful guys at www.memset.com hooked me up with one of their miniservers. I got it about a montha go and spent 2 days fighting with CVS over an SSH link to get it up and running, which I did eventually, so now I can happily upload my source code to the server to keep it safe and backed up. But today I deced to finish off the server and and the LAMP components, (L)inux (A)pache (M)ySQL (P)HP, which are to be installed in that order. Well Linux is already on in the form of Debian 3.1, apache was installed too, but I checked to make sure using:
apt-get install apache
as the root user and it returned that apache was already at the latest version. I then moved on MySQL which is as easy to install as:
apt-get instal mysql-server
After a couple of minutes the database server was fully installed with all the correct users and groups added, all I needed to do was set up the root password to secure it against attacks using:
mysqladmin -u root password mypassword
So far so good. Now to PHP, unfortunately with Debian being slightly behind in the development of certain packages I wasn’t going to be able to install PHP from the repository as I needed PHP 5 to use certain features like SimpleXML. To be able to do this I downloaded the latest source to my local PC and then attempted to send the tarball via ftp to my server. I had already setup VSFTPD to allow local users to login to the server, so thought I would be laughing, but after 10 minutes frustration of being denied acces with gFTP it was time to find out the problem. After much messing about with Webmin to see if it was a problem with access privileges I still couldn’t get in. So back to the vsftpd.conf setup file (found in /etc) and had another look through only to find I hadn’t set the option to restrict users to their home directories when logging in. Which is a very sensible thing to do, but nowhere did it say it would completely deny access to the system via FTP if it wasn’t set!!!! So if you ever have problems in a similar situation then just check to make sure both are set to on.
After that little hiccup it was on with the install. To build PHP as an apache module you will need apache-dev installed so a quick command:
apt-get install apache-dev
is all thats needed. Then extract the PHP source code:
gunzip < php-5.0.5.tar.gz | tar xvf –
Next go into the php directory and configure with:
./configure –with-apxs –with-mysql
this ensures it will be built as a compatible apache module with support for mysql. This is where things started to go wrong as I required a host of packages to get PHP to build:
So I strongly suggest you install all of these before trying to configure PHP. Once all of these wre installed it configured correctly. Then:
to build it. Sit back relax and wait for the server to compile it all up. Took my miniserver about 15 mins to build. Then:
To make sure everything goes in the correct places. We then need to make sure apache knows about php files, so edit the httpd.conf file found in /etc/apache, look for the line that contains:
#AddType application/x-httpd-php .php
Remove the # and restart apache within the /etc/init.d directory with:
You can then knock up a quick test php page with the line in it. Place the file within the server root (normally /var/www) and navigate to it in a browser, the page should display all the info about the currently installed version of PHP.
Basically thats it, pretty simple and can be completed in under an hour. So now I have my miniserver set up and almost ready for some development work, the next job is to install phpmyadmin to allow me to admin the mysql server through a browser and also install bugzilla to track bugs on the projects I am working on. I would also like to add some kind of control panel ala plesk to allow me to host multiple sites on the server.