From this post you are going to learn how to set up LAMP server on your linux operating system. I'm using GNU/Linux Debian 6.0 distro. You can directly apply these methods for DEB based Linux systems (Ubuntu). For the RPM based systems (Redhat, Fedora, Suse ...... ) you need to apply different commands.
Ex: for DEB
#apt-get install package-name
for RPM
$ yum install package-name
$ zypper install package-name
LAMP again.........
First of all you need to install few packages, you can't find a package called LAMP, LAMP is a collection of packages which belongs to PHP and MySQL.
1.you need to update your source list.
#apt-get update
then install apache2 and php5 or any php version which is compatible to your distro.
#apt-get install apache2 php5 libapache2-mod-php5
2. Run a php script
<?php
echo "Hello World\n";
?>
echo "Hello World\n";
?>
save this code in to the test.php file and you should place it /var/www/. (you can give any name with php extinction)
interpret the code by using php command
# php /var/www/test.php
3. MySQL and phpMyAdmin
To do database stuff you need to install MySQL (complete package with most of the utilities) and for the php database stuff you need to install phpMyAdmin.
#apt-get install mysql-server mysql-client php5-mysql
#apt-get install phpmyadmin
4. Using MySQL
To use MySQL, you need to have a user name and password. In order to add a new user ....................
#mysql
you will get a prompt like this
mysql>
mysql> CREATE DATABASE myData;
mysql> GRANT ALL ON myData.* TO name@localhost IDENTIFIED BY 'password';
mysql> exit
test your user name
# mysql -u name -p myData
5. Dealing with phpMyAdmin
phpMyAdmin a web based SQL database handler. In order to use phpMyAdmin open your favorite web browser and use this URL ( if you haven't set a domain name )
http://localhost/phpmyadmin/
and give your user name and password there. ( which you have created for the SQL database )
6. Run php in your web browser
We have already done with the basic LAMP configuration. Still we haven't check apache web server (you don't need to configure apache2.conf file for the basic LAMP configuration).
I. Create a php script file (as I explained before ) in the /var/www/ directory.
II. Just open a web browser again and type
http://localhost/test.php
Note: red color - user define names (not keywords)
Thatz it. Enjoy the LAMP server.



No comments:
Post a Comment