Linux under apache+mysql+php RPM package installation Implementation Discuz Forum

Source: Internet
Author: User
Tags egrep

1. Environmental Statement and preparation

[[email protected] ~]# yum list | egrep -i  "(httpd|mysql|php)"  |  grep  ' installed ' This system is not registered with rhn. rhn support will be disabled.httpd.i386                                 2.2.3-11.el5            installed       mysql.i386                                 5.0.22-         installed        mysql-server.i386                         5.0.22-          installed       perl-DBD-MySQL.i386                        3.0007-1.fc6           installed        php.i386                                   5.1.6-15.el5           installed        php-cli.i386                               5.1.6-15.el5           installed        php-common.i386                           5.1.6-15.el5            installed       php-mysql.i386                             5.1.6-15.el5            installed       php-pdo.i386                               5.1.6-15.el5            installed       [[email protected] ~]# 


First, apache+mysql+php all use yum source installation complete, you can mount the installation of ISO CD-ROM, made into a yum source.

My yum configuration file is listed below for your reference.

[Email protected] ~]# Cat/etc/yum.repos.d/mytest1.repo [mytest1]name=myyumtest1baseurl=file:///home/yum/cdrom/ Serverenabled=1gpgcheck=0[[email protected] ~]#

Second, about the configuration of Apache.

For a detailed analysis of Apache httpd, refer to my blog:

What needs to be explained here is that I will be experimenting with a virtual host based on ServerName. The configuration is as follows:

[Email protected] ~]# cat/etc/httpd/conf.d/myhttpd.conf namevirtualhost<virtualhost> documentroot/web/v1/servername errorlog logs/ Cu Stomlog logs/ common</virtualhost><virtualhost> DocumentRoot/ Web/v2/servername errorlog logs/ customlog Logs/ Co Mmon</virtualhost>[[email protected] ~]#

Of course, you need to configure the hosts in the client, the servername and IP to match the relationship.

Third, about the configuration of MySQL.

For MySQL installation and getting started using, you can refer to my blog:

It is important to note that the user's access authorization:

mysql> show grants for  ' root ' @ '% '; +---------------------------------------------------- ----------------------------------------------------------------------------+| grants for [ email protected]%                                                                                                                    |+------------------------------------------------------------------------ --------------------------------------------------------+| grant all privileges on *.* to  ' root ' @ '% '  IDENTIFIED BY PASSWORD  ' *a488bc0454fa2fd261762bd37034100fff0b0510 '  with grant  option | +------------------------------------------------------------------------------------ --------------------------------------------+1 row in set  (0.00 sec) mysql>

Because PHP needs to access MySQL, the Php-mysql package needs to be installed. Like accessing Oracle,mysql in JDBC, etc.

Database when need to provide the same driver jar.

2.Test LAMP

After the first stage of the lamp platform is built, we should test the lamp to make sure that they work together.

The first step is to start httpd,mysql.

[[email protected] ~]# service httpd startstarting httpd:                                               [  OK  ][[email protected] ~]# service  mysqld startstarting mysql:                                              [  OK   ][[email protected] ~]# [[email protected] ~]# netstat -tnlp |  egrep  ' (80|3306) ' tcp        0       0      *                     Listen      3686/mysqld         tcp         0      0 :::80                         :::*                          listen      3566/ httpd          [[email protected] ~]#

It can be found that the httpd,mysql has started normally and is listening at the specified port.

The second step is to test httpd with PHP.

[Email protected] v2]# Cd/web/v2[[email protected] v2]# cat test.php <?phpphpinfo ();? >[[email protected] v2]#

Test access is as follows:

650) this.width=650; "src=" Http:// "title=" 001. PNG "alt=" wkiom1qkzr6wgleaaakku9ew6i4889.jpg "/>

Explains that Apache can already interact with PHP.

The third step is to test the apache,mysql,php.

[Email protected] v2]# Pwd/web/v2[[email protected] v2]# cat index.php <?php#phpinfo (); $con =mysql_connect (' ', ' root ', ' Zhangfengzhe '); if (! $con) {echo "Can not connect to MySQL";} mysql_select_db ("MYDB1", $con); $result = mysql_query ("SELECT * from users"); ><table border= ' 1 ' ><?phpwhile ($row = mysql_fetch_array ($result)) {echo ' <tr><td> ', $row [' ID '  ], "</td><td>", $row [' name '], "</td></tr>"; }mysql_close ($con);? ></table>[[email protected] v2]#

The test access results are as follows:

650) this.width=650; "src=" Http:// "title=" 002. PNG "alt=" wkiol1qkaq3cykguaabpy0wpzj4063.jpg "/>

To view the MySQL database:

mysql> use mydb1; reading table information for completion of table and column  Namesyou can turn off this feature to get a quicker startup  with -adatabase changedmysql> show tables;+-----------------+| tables_in_ mydb1 |+-----------------+| users           |  +-----------------+1 row in set  (0.00 sec) mysql> select *  from users;+------+----------+------+----------+| id   | name      | sex  | birthday |+------+----------+------+----------+| 001   | zhangsan | NULL | NULL     | | 002   | lisi     | NULL | NULL     | +------+----------+------+----------+2 rows in set  (0.00 sec) mysql> 

By now, lamp testing has been completed, and they are ready to work together.

3. Install the deployment Discuz

Enter download Zip, you can choose the UTF-8 version.

upload the downloaded zip package to the Linux server, unzip it, copy all the files under the upload directory to/WEB/V1, and then access the for installation.

650) this.width=650; "src=" Http:// "title=" 003. PNG "alt=" wkiom1qkbsxcmqfcaag7qbd8mfe363.jpg "/>

In the installation process, you need to change the permissions on the directory, according to the prompts to modify the item.

650) this.width=650; "src=" Http:// "title=" 004. PNG "alt=" wkiom1qkbhhwv2wraahfe8yfzj8664.jpg "/>

Specifies information about the database connection. In fact, this step will complete the creation of the database-related tables.

Once the installation is complete, you can access the front desk:

650) this.width=650; "src=" Http:// "title=" 006. PNG "alt=" wkiom1qkb2usal72aag0gavddou047.jpg "/>


650) this.width=650; "src=" Http:// "title=" 007. PNG "alt=" wkiom1qkb8aitp1waag0xkjdjyk874.jpg "/>

View MySQL Related information:

mysql> use luntan; reading table information for completion of table and column  Namesyou can turn off this feature to get a quicker startup  with -adatabase changedmysql> show tables;+-----------------------------------+|  Tables_in_luntan                   |+-----------------------------------+| pre_common_admincp_cmenu           | | pre_common_admincp_group           | | pre_common_admincp_member          | | pre_common_admincp_perm            | | pre_common_admincp_session        | | pre_common_admingroup             |  | pre_common_adminnote               | | pre_common_advertisement           | | pre_common_advertisement_custom   | | pre_common_banned                  |

At this point, our lamp not only built, but also deployed a forum application, it is so simple ~

This article is from the "I want to surpass myself" blog, please be sure to keep this source

Linux under apache+mysql+php RPM package installation Implementation Discuz Forum

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.