In today's network applications, Linux + Apache + MySQL + PHP has become an important combination application. here we will take PhP5 as an example to talk about the installation and configuration of Linux + Apache + MySQL + PhP5. after such work, we can use phpbb2 to set up our own forum.
1. Install MySQL
MySQL can be downloaded from htt: // www.mysql.org. decompress the package and enter its directory. Let's take a look at the install-binary file provided by MySQL. Here we talked about the MySQL installation method:
$ Groupadd MySQL (add a MySQL Group)
$ Useradd-u MySQL (add username MySQL)
During the installation process, we installed MySql in the/usr/local directory:
$ CD/usr/local
Move the extracted directory here:
$ MV/path/MySQL-full-name
Create a link:
$ Ln-s mysql-full-name MySQL
$ CD MySQL
$ Scripts/mysql_install_db -- user = MySQL
$ Chown-r root.
$ Chown-r Mysql Data
$ Chgrp-r MySQL.
$ Bin/mysqld_safe -- user = MySQL &
In this way, MySQL is installed on our machine.
2. install Apache:
Apache can be downloaded from the http://www.apache.org. Unzip the downloaded installation package, enter the directory after decompression, execute the following command:
#./Configure -- prefix =/usr/local/apache2
Here we will install Apache in the/usr/lcoal directory
Compile:
# Make
Installation:
$ Make install
In this way, Apache is installed on our machine.
You can enter http: // localhost in our browser. If the Apache interface is displayed, the installation is successful.
3 install PhP5:
PhP5 can be downloaded from the http://www.php.net. Unzip the downloaded installation package, enter the decompressed directory, execute the following command:
#./Configure -- with-apxs2 =/usr/local/apache2/bin/apxs -- With-mysql =/usr/local/MySQL -- With-Gd -- enable-mbstring
Configure PhP5 to load Apache modules, MySQL and GD.
Compile:
# Maek
Installation:
$ Make install
After this step, we will install PhP5 on our machine.
4. Configure Apache:
Run the following command to open the Apache configuration file:
$ VI/usr/local/apache2/CONF/httpd. conf
In general, it seems that we like the directory stored on the default Apache page, so that we can change this directory to our favorite directory:
Find the DocumentRoot line and change its value to/home/mylxiaoyi/documents/Web
Find the directory row and change its value to/home/mylxiaoyi/documents/web/
After such configuration, we changed the Apache page Directory to a convenient directory.
We can simply write a home directory and store it in the/home/myxliaoyi/documents/web/directory, and then restart Apache:
$/Usr/local/apache2/bin/apachect1 restart
Then input http: // lcoalhsot in our browser. If we can see the home page we wrote, it means that our Apache has been configured successfully.
The following configuration allows Apache to support PhP5. In this configuration file, add the following statement:
# Mount the PhP5 module:
Loadmodule php5_modeule modules/libphp5.so
# Tell Apache to parse PhP5:
Addtype application/X-httpd-PHP. php. phtml
Addtype application/X-httpd-PHP-source. PHPs
Restart Apache after saving and exiting:
$/Usr/local/apache2/bin/apachect1 restart
Then we compile a simple PHP page:
<HTML>
<Head>
<Title>
Test PHP
</Title>
</Head>
<Body>
<? PHP echo "hello";?>
</Body>
</Html>
Save as hello. PHP, save it in our web directory, and enter http: // localhost/hello in our browser. PHP. if Hello is displayed on the page, the PHP configuration is successful.
Now our Linux + Apache + MySQL + PHP has been configured successfully, so we can build our PHP website.
5. Install phpMyAdmin:
We can use phpMyAdmin to manage our database, which can be downloaded from the http://sourceforge.net. decompress the downloaded software package to our web directory and change its directory name to phpMyAdmin (you can also use the default name without changing it ). go to this directory and use our VI to open config. inc. PHP configuration, find the following lines:
$ Cfg ['blowfish _ secret'] = 'sirtoozee '; (the encryption syntax we use)
$ Cfg ['servers'] [$ I] ['user'] = 'root'; (the username used to log on to the database)
$ Cfg ['servers'] [$ I] ['Password'] = ''; (password used to log on to the database)
After saving and exiting, enter http: // localhost/PHPmyAdmin/index. php In Our browser
If we can see our management interface, we can see that our management is working normally. If not, we need to check the username and password we used to log on to the database.
6. Set up the phpbb2 Forum:
Phpbb2 can be downloaded from here: http://www.phpbb2.de
After the download, We decompress it to the web directory, and then input http: // localhost/phpbb2/index in our browser. in this way, we can see the Forum installation interface. after entering some simple information, we can start the installation process. after our installation is complete, we must remember to delete the contrib and install directories under the Directory, which can prevent hackers from re-installing and damaging our existing forum. in this way, we set up our own forum. we can use http: // localhost/phpbb2/admin/index. PHP to manage our forum.
With the combination of Linux + Apache + MySQL + PhP5, we can start our own network journey. Er >>> :-)