By Damien LEFEVRE: Wednesday 4 October 2006, 19:04
Installing Apache2, PHP, MySQL, PHPMyAdmin on Debian
Follow the guide and install the elements one by one! I tried to install everything in a row and it screwed everything.
APACHE2:
This will install and configure APACHE. The root folder is /var/www..
# apt-get install apache2
PHP5:
This will install and configure PHP5 to work with APACHE2.
# apt-get install php5
To check if the interaction between PHP and APACHE is functional, create /var/www/essay.php containing:
<?php
phpinfo();
?>
Then launch it from your explorer from http://localhost/essay.php
To configure PHP:
PHP is modular, several module exist and can be loaded or not in /etc/php.ini
A list of available modules for PHP is at http://www.php.net, and the debian package corresponding are:
$ apt-cache search php5 | less
MySQL:
# apt-get install mysql-server
Configuring MySQL:
One need to know that UNIX and MySQL users are different. We start by typing in a root terminal:
mysql
We should then get something like:
Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 133 to server version: 3.23.49-log Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql>
The SQL connection to the server works properly. Now exit :
mysql> quit Bye
We need to give a password to the root user for Mysql :
mysqladmin password yourpassword
Make a root connection to the SQL server :
mysql -p Enter password : Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 9 to server version: 5.0.20-Debian_1-log Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql>
To prevent using root for the connections, we now create a adminsql user:
mysql> use mysql; mysql> select * from user; mysql> GRANT ALL PRIVILEGES ON *.* TO adminmysql@localhost IDENTIFIED BY 'motdepasse' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; mysql> select * from user where User='adminmysql'; mysql> quit Bye
Now we connect like:
mysql -u adminmysql -p
That's it for the first MySQL configuration
To check the SQL server :
ps aux |grep mysql
The porcess is called mysqld.
/etc/init.d/mysql stop // to stop the service /etc/init.d/mysql start // to start the service
To insure a good interaction between PHP5 et mysql :
apt-get install php5-mysql
PhpMyAdmin:
PhpMyAdmin is not mandatory but it's a great help to manage databases!
apt-get install phpmyadmin
To check that everything is functional, go to : http://localhost/phpmyadmin/
If you followed the previous steps, you should get the PhpMyAdmin main page, asking for a password.
This is the one you set previously with adminmysql user.
Everything should be functional, you manage your database with phpmyadmin and you put your files to /var/www.
You can of course change the root document in /etc/apache2/httpd.conf



Comments
No comment for the moment.
Add a comment
Les commentaires pour ce billet sont fermés.