Today I wanted to try out and start learning PHP scripting language a bit. PHP is server-side scripting language so for it to work I need a server that supports it. Apache web server is widely used with PHP so I'm going for that combo. Also, I would like to have a MySQL database support.
Here's how I did that on Ubuntu 8.04 LTS. Googling around I found that the wanted combo is named LAMP (Linux-Apache-MySQL-PHP) task and it can be installed using tasksel command:sudo tasksel install lamp-server
But unfortunately it gave me an error:tasksel: aptitude failed (100)
Is it a bug or something wrong with my machine? Anyone has an answer please comment.
So I turned to the good old apt-get:sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql
After the installation you'll be asked for MySQL 'root' user password. Enter it and don't forget! :) Now, the Apache server can be started with:$ sudo /etc/init.d/apache2 start
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
To hide this strange "Could not... " message you need to create a file /etc/apache2/conf.d/fqdn and put this line in it:ServerName localhost
Now to check functionality create a 'test.php' in the /var/www/ directory with the line:<?php phpinfo();?>
Open up your browser and type http://localhost/test.php in the address bar. If you get something like this:
you did it!
For configuring databases, user privileges etc. there is an application called "phpmyadmin" that really ease the job.
Tuesday, 29 July 2008
Installing Apache2 server with PHP and MySQL support
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment