LAMP
LAMP is an acronym for L inux, Apache, MySQL, PHP. In this post I try to describe how you can install Apache2 webserver on Ubuntu 10.10 server with PHP5 (mod_php) and MySQL support.
1 Getting Started
In the description here I demonstrated using the host server named server1.example.com with IP address 192.168.1.3 These settings may vary with the condition of your server, so you must adjust the IP host and in accordance with the state of your computer.
Open Terminal and run with root privileges / user logged in as root.
sudo su
Please enter your password
2 Installing MySQL 5
First we install MySQL 5 like this:
#apt-get install mysql-server mysql-client
You will be asked to provide a password for the MySQL root user - this password is valid for the user root @ localhost and root@server1.example.com, so we do not need to specify a MySQL root password manually later on:
The new password for user "root" MySQL: <- yourrootsqlpassword
Repeat password for user "root" MySQL: <- yourrootsqlpassword
LAMP is an acronym for L inux, Apache, MySQL, PHP. In this post I try to describe how you can install Apache2 webserver on Ubuntu 10.10 server with PHP5 (mod_php) and MySQL support.
1 Getting Started
In the description here I demonstrated using the host server named server1.example.com with IP address 192.168.1.3 These settings may vary with the condition of your server, so you must adjust the IP host and in accordance with the state of your computer.
Open Terminal and run with root privileges / user logged in as root.
sudo su
Please enter your password
2 Installing MySQL 5
First we install MySQL 5 like this:
#apt-get install mysql-server mysql-client
You will be asked to provide a password for the MySQL root user - this password is valid for the user root @ localhost and root@server1.example.com, so we do not need to specify a MySQL root password manually later on:
The new password for user "root" MySQL: <- yourrootsqlpassword
Repeat password for user "root" MySQL: <- yourrootsqlpassword
Apache2 is available as an Ubuntu package, therefore we can install it like this:
#apt-get install apache2
Now direct your browser to http://192.168.1.3, and you'll see the placeholder page Apache2 (It works!):
Standard Apache document root is / var / www on Ubuntu, and the configuration file is / etc/apache2/apache2.conf. Additional configuration is stored in a subdirectory of the / etc/apache2 as / etc/apache2/mods-enabled (for Apache module), / etc/apache2/sites-enabled (for virtual host), and / etc/apache2/conf d .
4 Installing PHP5
We can install PHP5 and Apache PHP5 module as follows:
#apt-get install php5 libapache2-mod-php5
restart Apache
/ etc/init.d/apache2 restart
5 Testing PHP5 / Getting Details About Your Installation PHP5
The document root of the default web site is / var / www. We will now create a small PHP file (info.php) in that directory and call it in the browser. The file will display lots of useful details about our PHP installation, such as PHP versions installed.
/ var / www / info.php
then
sudo gedit / var / www / testing.php
Type the following line:
<? php infophp ()>?
Now we try to call the file in the browser (eg http://192.168.1.3/info.php):
As you see, PHP5 works, and it is working through Apache 2.0 Handler, as shown in the Server API line. If you scroll down, you will see all modules which are activated in PHP5. MySQL is not listed there which means we do not have MySQL support in PHP5 yet.
6 Getting MySQL Support In PHP5
To get MySQL support in PHP, we can install php5-mysql package. This is a good idea to install some other PHP5 modules as well as you might need for your application. You can search for available PHP5 modules like this:
apt-get search php5
Choose what you need and install it like this:
apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imap php5-Imagick php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xsl php5-XMLRPC-json php5
Now restart apache2:
/ etc/init.d/apache2 restart
Now re-http://192.168.1.3/info.php on your browser and scroll down to the module again. You should now find lots of new modules there, including the MySQL module:
7 phpMyAdmin
phpMyAdmin is a web interface where you can manage your MySQL database. That's a good idea to install it:
apt-get install phpmyadmin
You will see the following questions:
Web server to reconfigure automatically: <- apache2
Configure database for phpmyadmin with dbconfig-common? <- No
After that, you can access phpMyAdmin under http://192.168.1.3/phpmyadmin/:
Phpmyadmin login page should appear like this:
Enter your user name and password (default user is 'root')
If it appears at the bottom of the page like this means a successful installation.
Referral link:
Apache: http://httpd.apache.org/
PHP: http://www.php.net/
MySQL: http://www.mysql.com/
Ubuntu: http://www.ubuntu.com/
phpMyAdmin: http://www.phpmyadmin.net/
0 comments:
Post a Comment