How to install Apache, PHP and MySQL on Debian
Apache, PHP and MySQL on Linux Debian
1. General
This article will guide you in installing a Web server Apache with PHP, MySQL and phpMyAdmin. This assumes that you have an Internet connection and an environment Debian GNU Linux. If you do not have GNU/ Debian Linux operating system, then you can visit their official site and see the documentation on installation.
2. Update apt sources
To install the latest packages, it is necessary to update the package list of the tool apt . Please log in root in a terminal using the command su. Type ensuite apt-get update. Once the download is complete, you have the list of latest packages.
Re: How to install Apache, PHP and MySQL on Debian
3. Installing Apache 2
This is the only Web server. Without documentation, no server side language, no database can rally work.
Just issue the following command in your terminal as a root user
Code:
apt-get install apache2
Total size: 5252 KB (approximate)
You can verify that the server is running by typing
in your favorite browser
4. Installing Apache 2 documentation
This documentation is visible from a virtual server.
Just issue the following command from the terminal as a root user
Code:
apt-get install apache2-doc
Total size: 14.3 Mb (approximate)
This material is visible by typing
Code:
http://127.0.0.1/manual/
in a browser. You restart the server using the command
Code:
/ Etc/init.d/apache2 restart.
5. Installing MySQL
The popular free database MySql is very powerful. Version 4.1 supports nested queries, so why not use it?
You have to issue the following command in the terminal as a root user
Code:
apt-get install mysql-server-4.1
Total size: 41.0 MB (approximate)
Your database is operational, we must now set a password for the super user root to avoid any security. In the terminal type
You are then directly connected to root on the MySQL server. The first thing to do is create a password.
Code:
mysql> USE mysql; mysql> UPDATE user -> SET password = PASSWORD
('motsecret') -> WHERE user = 'root'; mysql> flush privileges;
Disconnect the command you exit, you can reconnect using
By doing so, MySQL will prompt you for your password.
Re: How to install Apache, PHP and MySQL on Debian
6. Installing PHP 4
PHP allows you to generate Web pages dynamically. It is a server-side programming language. It is able to fetch information in the MySQL database.
Just issue the following command in the terminal as a root user
Code:
apt-get install libapache2-mod-php4 php4-mysql php4-gd php4-cli
Total size: 8012 KB (approximate)
We installed the PHP 4 module for Apache 2 module that allows communication between PHP and the MySQL server. A PHP interpreter command line, very convenient. For other packages php4 to install, do php4 apt-cache search. Search for the package name corresponding to your needs, then install it if necessary. Here is the list of packages related to PHP extensions:
Code:
php4-apd
php4-auth-pam
php4-cgi
php4-cli
php4-common
php4-curl
php4-dbtcp
php4-dev
php4-domxml
php4-gd
php4-gpib
php4-idn
php4-imagick
php4-imap
php4-interbase
php4-ldap
php4-maxdb
php4-mcal
php4-mcrypt
php4-mhash
php4-mysql
odbc php4-
php4-pear
php4-pear-log
php4-pgsql
php4-ps
php4-recode
php4-rrdtool
php4-snmp
php4-sqlite
php4-sqlrelay
php4-sybase
php4-syck
php4-tclink
php4-xslt
7. Installing phpMyAdmin
This tool developed in PHP will be very useful to administer and manage your databases.
Issue the following command in the terminal as a root user
Code:
apt-get install phpmyadmin
Total size: 9486 kb (approximate)
Then you will have access to phpMyAdmin by typing in the address bar
Code:
http://127.0.0.1/phpmyadmin/
After you restart the Apache server log in as root. You then have the possibility to create databases, manage privileges, then create users and give them rights on these grounds.
Re: How to install Apache, PHP and MySQL on Debian
8. Create a directory for users (personal pages) of the machine
To ensure that each system user has a space to host their web pages, you need to configure Apache in the file
Code:
/ Etc/apache2/apache2.confusing
using vim or any other editor which you like and this as root (control su) Locate the following lines:
Code:
# UserDir Is Now a module # UserDir public_html # UserDir disabled root
# <Directory /home/*/public_html> # AllowOverride FileInfo AuthConfig Limit
# Options Indexes # SymLinksIfOwnerMatch IncludesNOEXEC </Directory>
Uncomment all and then store at
Code:
# UserDir Is Now a module UserDir public_html UserDir disabled root
<Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit
Options Indexes SymLinksIfOwnerMatch IncludesNOEXEC </Directory>
For the changes to take effect, we will have to restart the Web server using the command
Code:
/Etc/init.d/apache2 restart
Run this command in the terminal as a root user. Now every user has the ability to implement its own homepage. For this, they simply create a directory name public_html, his home directory. The directory should at least be running for the other group and owner. The directory public_html must be readable by everyone.
Code:
$ cd / home / test /
$ mkdir public_html
$ chmod 755 public_html /
$ chmod o + x. /
$ cd public_html
$ cat> index.php <?php phpinfo(); ?>
CTRL + D to end of file
From now on, personal Web space is available from the address
Code:
http://127.0.0.1/ ~ user /
Or in the case of the example above
Code:
http://127.0.0.1/ test ~ /
9. Conclusion
I hope this tutorial will help you. If you are going to use these software's that is Apache, MySql, PHP on GNU/Linux Debian system, then you will get a great performance from your web server. GNU/Linux Debian is very well know for its stability.
Re: How to install Apache, PHP and MySQL on Debian
Thank you so much for this installation tutorial