Linux下编译安装Apache报APR

by admin on 2019年1月31日
我在编译安装完Nginx、MySQL和PHP(见之前一篇博客:LNMP环境搭建详细教程)之后,进行apache的编译安装:

cd /usr/local/src 

wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.34.tar.gz 

tar zxvf httpd-2.4.34.tar.gz  

cd httpd-2.4.34  

./configure --prefix=/usr/local/httpd  

就在这个时候提示:configure: error: APR not found. Please read the documentation.
这说明缺少APR依赖,那么安装即可,可以用yum安装但是不推荐,因为yum安装的APR版本可能不足以支持你所安装的apache版本,所以还是要用编译安装高版本的APR:

cd /usr/local/src

wget http://archive.apache.org/dist/apr/apr-1.6.3.tar.gz 

wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz

  linux下布署php项目条件足以分为三种,一种选择Apache,php,mysql的压缩包安装,一种用yum命令举办设置。

  linux下布置php项目环境得以分为二种,一种选取Apache,php,mysql的压缩包安装,一种用yum命令进行安装。

linux下部署php项目-Apache、php、mysql关联,-apachemysql

  linux下安插php项目条件得以分成二种,一种采用Apache,php,mysql的压缩包安装,一种用yum命令举行设置。

行使三种软件的削减包进行安装,须要手动配置三者之间的关系。apache和php之间的安顿没有啥样难度,不过和mysql进行安排的时候就须求对php的打听了。

以下是用yum在linux中安插php环境:

 

梯次下载上述五个安装包并逐个解压缩:

应用二种软件的削减包举办安装,须求手动配置三者之间的关系。apache和php之间的安顿没有啥样难度,不过和mysql进行安排的时候就必要对php的问询了。

使用两种软件的回落包进行设置,须求手动配置三者之间的关系。apache和php之间的安插没有何难度,可是和mysql举行布局的时候就须求对php的问询了。

MySql

 

  1.mysql和apache最好是第一进行设置的,因为在陈设php的时候须要与mysql和apache举办关联配置和测试

首先下载mysql-sever文件,因为博主linux环境是CentOS版本,yum源中一般没有健康安装mysql时的mysql-sever文件,要求去官网上下载

1.下载mysql-service文件

[[email protected] ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

2.安装mysql-service文件

[[email protected] ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm

 

   2.安装mysql

[[email protected] ~]# yum install mysql-community-server

 

   3.设置已毕之后启动mysql服务

[[email protected] ~]# service mysqld restart

 

  4.
起先安装的mysql是从未密码的,用户名默许是root。所以我们须要修改密码,用mysql命令行进行改动

 1.进入mysql命令行

[[email protected] ~]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 474801
Server version: 5.6.36 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

2.使用命令进行密码修改

mysql> set password for 'root'@'localhost' = password('你要修改的密码');
Query OK, 0 rows affected (0.06 sec)

 

  5.因为博主是用当地navicat软件来连接linux下的mysql的,所以如果要在地面访问的话,就须要改一下mysql数据库中的user表了

1.操作mysql数据库表

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> 


2.查看user表中的数据(在mysql命令行中可以直接进行sql语句编写)

mysql> select * from user;
+-----------+------+-----------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
| Host      | User | Password                                  | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin                | authentication_string | password_expired |
+-----------+------+-----------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
| %         | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| localhost | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| 127.0.0.1 | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| ::1       | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| tele-1    |      |                                           | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            | N                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password | NULL                  | N                |
+-----------+------+-----------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
5 rows in set (0.00 sec)

mysql> 

 

  3.博主的表中是修改将来的表了,想要远程访问,就需求上面红色标注的多少了,Host指的是可以访问此数据库的ip地址,%代表的是所有的请求都得以连接进来。

世家可以修改一条数据,也可以添加一条数据。可是最好不要涂改上面灰色标注的多寡,修改语句就是底下的格式

mysql> update user set Host = '%' where ???

 

  4.尾声推出exit或者\q都是脱离mysql命令行的主意

mysql> \q
Bye

 

 

 

tar zxvf apr-1.6.3.tar.gz

tar zxvf apr-util-1.6.1.tar.gz

cd/usr/local/src/apr-1.6.3 #安装apr

./configure --prefix=/usr/local/apr  

make && make install

cd /usr/local/src/apr-util-1.6.1  #安装apr-util

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr   

make && make install

依赖全部安装完毕后再次切换到httpd的安装目录安装apache:

cd /usr/local/src/httpd-2.4.34

./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

make && make install

以下是用yum在linux中配备php环境:

以下是用yum在linux中布署php环境:

 安装Apache

 

  1.apache装置格局相对简便易行

[[email protected] ~]# yum install httpd

 

  2.外网访问虚拟机中的地址,我们就需要修改一下apache的布置文件/etc/httpd/conf/httpd.conf

 

 找到  #ServerName www.example.com:80            改为  ServerName
localhost:80

   如右图所示:

 

 

 

 

 找到  #Linux下编译安装Apache报APR。Listen                              
  改为  Listen:8080(linux中开放的端口号80XX)

 如右图所示:

   

 

 

 

 

 

  

  3.修改完毕未来我们须要再一次启航httpd服务,并查阅启动状态

[[email protected] ~]# service httpd start
Redirecting to /bin/systemctl start  httpd.service
[[email protected]-2 ~]# service httpd status
Redirecting to /bin/systemctl status  httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-06-05 15:57:34 CST; 5s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 54532 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
  Process: 39046 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
 Main PID: 54573 (httpd)
   Status: "Processing requests..."
   Memory: 15.8M
   CGroup: /system.slice/httpd.service
           ├─54573 /usr/sbin/httpd -DFOREGROUND
           ├─54576 /usr/sbin/httpd -DFOREGROUND
           ├─54577 /usr/sbin/httpd -DFOREGROUND
           ├─54578 /usr/sbin/httpd -DFOREGROUND
           ├─54579 /usr/sbin/httpd -DFOREGROUND
           └─54580 /usr/sbin/httpd -DFOREGROUND

Jun 05 15:57:34 tele-2 systemd[1]: Starting The Apache HTTP Server...
Jun 05 15:57:34 tele-2 systemd[1]: Started The Apache HTTP Server.

 

  4.那时候您就足以访问你的服务器了,输入localhost或者ip地址,出现一个Apache
test page powered by centos的测试页面

 

到此设置成功,想要启动、为止、重启apache要求用到命令:

 

Linux下编译安装Apache报APR。 

PHP

/usr/local/httpd/bin/httpd -k start   ##开启

/usr/local/httpd/bin/httpd -k stop    ##停止

/usr/local/httpd/bin/httpd -k restart ##重启

MySql

 

  1.mysql和apache最好是首先举行安装的,因为在配备php的时候必要与mysql和apache举办关联配置和测试

第一下载mysql-sever文件,因为博主linux环境是CentOS版本,yum源中一般没有例行安装mysql时的mysql-sever文件,必要去官网上下载

1.下载mysql-service文件

[root@tele-1 ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

2.安装mysql-service文件

[root@tele-1 ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm

 

   2.安装mysql

[root@tele-1 ~]# yum install mysql-community-server

 

   3.安装完结之后启动mysql服务

[root@tele-1 ~]# service mysqld restart

 

  4.
开始安装的mysql是不曾密码的,用户名默许是root。所以大家要求修改密码,用mysql命令行进行改动

 1.进入mysql命令行

[root@tele-1 ~]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 474801
Server version: 5.6.36 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

2.使用命令进行密码修改

mysql> set password for 'root'@'localhost' = password('你要修改的密码');
Query OK, 0 rows affected (0.06 sec)

 

  5.因为博主是用本地navicat软件来连接linux下的mysql的,所以假诺要在地头访问的话,就要求改一下mysql数据库中的user表了

1.操作mysql数据库表

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> 


2.查看user表中的数据(在mysql命令行中可以直接进行sql语句编写)

mysql> select * from user;
+-----------+------+-----------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
| Host      | User | Password                                  | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin                | authentication_string | password_expired |
+-----------+------+-----------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
| %         | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| localhost | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| 127.0.0.1 | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| ::1       | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| tele-1    |      |                                           | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            | N                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password | NULL                  | N                |
+-----------+------+-----------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
5 rows in set (0.00 sec)

mysql> 

 

  3.博主的表中是修改之后的表了,想要远程访问,就须要上边粉色标注的数据了,Host指的是能够访问此数据库的ip地址,%代表的是怀有的哀告都得以连接进来。

大家可以修改一条数据,也可以添加一条数据。可是最为不要涂改上面灰色标注的数目,修改语句就是底下的格式

mysql> update user set Host = '%' where ???

 

  4.尾声推出exit或者\q都是脱离mysql命令行的形式

mysql> \q
Bye

 

 

 

MySql

 

  1.mysql和apache最好是首先进行设置的,因为在配备php的时候必要与mysql和apache举办关联配置和测试

先是下载mysql-sever文件,因为博主linux环境是CentOS版本,yum源中貌似没有正常安装mysql时的mysql-sever文件,必要去官网上下载

1.下载mysql-service文件

[root@tele-1 ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

2.安装mysql-service文件

[root@tele-1 ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm

 

   2.安装mysql

[root@tele-1 ~]# yum install mysql-community-server

 

   3.安装完成之后启动mysql服务

[root@tele-1 ~]# service mysqld restart

 

  4.
起来安装的mysql是从未有过密码的,用户名默许是root。所以我们须求修改密码,用mysql命令行进行修改

 1.进入mysql命令行

[root@tele-1 ~]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 474801
Server version: 5.6.36 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

2.使用命令进行密码修改

mysql> set password for 'root'@'localhost' = password('你要修改的密码');
Query OK, 0 rows affected (0.06 sec)

 

  5.因为博主是用地点navicat软件来连接linux下的mysql的,所以倘使要在本土访问的话,就必要改一下mysql数据库中的user表了

1.操作mysql数据库表

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> 


2.查看user表中的数据(在mysql命令行中可以直接进行sql语句编写)

mysql> select * from user;
+-----------+------+-----------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
| Host      | User | Password                                  | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin                | authentication_string | password_expired |
+-----------+------+-----------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
| %         | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| localhost | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| 127.0.0.1 | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| ::1       | root | *3ce8dad2446975d8b0c771bd7e48d15b | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| tele-1    |      |                                           | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            | N                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password | NULL                  | N                |
+-----------+------+-----------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
5 rows in set (0.00 sec)

mysql> 

 

  3.博主的表中是修改之后的表了,想要远程访问,就须求下面肉色标注的数码了,Host指的是足以访问此数据库的ip地址,%代表的是负有的央浼都得以一而再进来。

世家可以修改一条数据,也得以添加一条数据。可是最好不用涂改上边青色标注的数量,修改语句就是下边的格式

mysql> update user set Host = '%' where ???

 

  4.最终推出exit或者\q都是脱离mysql命令行的措施

mysql> \q
Bye

 

 

 

 

  1.php安装命令

[[email protected] ~]# yum install php

 

  2.平素一路安装,安装到位将来再一次重启httpd服务

[[email protected] ~]# service httpd start
Redirecting to /bin/systemctl start  httpd.service

 

  3.重启之后我们开展测试PHP相关新闻,我们新建一个PHP界面进行测试

在apache默许页面路径/``var``/www/html下新建一个test.php页面,添加代码

<?php
 phpinfo();
?>

     

 

  4.拜访这些页面,输入localhost/test.php,或者

ip:端口号/test.php就足以瞥见php环境的安插新闻了。如右图:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

此地自己在重启的时候就报了事先一篇博客:LNMP环境搭建详细教程中讲述的一个错误:

 安装Apache

 

  1.apache设置格局相对不难

[root@tele-2 ~]# yum install httpd

 

  2.外网访问虚拟机中的地址,大家就必要修改一下apache的安顿文件/etc/httpd/conf/httpd.conf

 

bf88必发唯一官网 1

 找到  #ServerName
www.example.com:80            改为  ServerName
localhost:80

   如右图所示:

 

 

 

 

bf88必发唯一官网 2

 找到  #Listen  
                              改为  Listen:8080(linux中开放的端口号80XX)

 如右图所示:

   

 

 

 

 

 

  

  3.改动形成将来大家需求重新启动httpd服务,并查看启动状态

[root@tele-2 ~]# service httpd start
Redirecting to /bin/systemctl start  httpd.service
[root@tele-2 ~]# service httpd status
Redirecting to /bin/systemctl status  httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-06-05 15:57:34 CST; 5s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 54532 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
  Process: 39046 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
 Main PID: 54573 (httpd)
   Status: "Processing requests..."
   Memory: 15.8M
   CGroup: /system.slice/httpd.service
           ├─54573 /usr/sbin/httpd -DFOREGROUND
           ├─54576 /usr/sbin/httpd -DFOREGROUND
           ├─54577 /usr/sbin/httpd -DFOREGROUND
           ├─54578 /usr/sbin/httpd -DFOREGROUND
           ├─54579 /usr/sbin/httpd -DFOREGROUND
           └─54580 /usr/sbin/httpd -DFOREGROUND

Jun 05 15:57:34 tele-2 systemd[1]: Starting The Apache HTTP Server...
Jun 05 15:57:34 tele-2 systemd[1]: Started The Apache HTTP Server.

 

  4.此时你就可以访问你的服务器了,输入localhost或者ip地址,出现一个Apache
test page powered by centos的测试页面

 

 安装Apache

 

  1.apache安装格局绝对不难

[root@tele-2 ~]# yum install httpd

 

  2.外网访问虚拟机中的地址,大家就须要修改一下apache的配备文件/etc/httpd/conf/httpd.conf

 

bf88必发唯一官网 3

 找到  #ServerName
www.example.com:80            改为  ServerName
localhost:80

   如右图所示:

 

 

 

 

bf88必发唯一官网 4

 找到  #Listen  
                              改为  Listen:8080(linux中开放的端口号80XX)

 如右图所示:

   

 

 

 

 

 

  

  3.修改完毕未来大家需求再度启航httpd服务,并查看启动状态

[root@tele-2 ~]# service httpd start
Redirecting to /bin/systemctl start  httpd.service
[root@tele-2 ~]# service httpd status
Redirecting to /bin/systemctl status  httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-06-05 15:57:34 CST; 5s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 54532 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
  Process: 39046 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
 Main PID: 54573 (httpd)
   Status: "Processing requests..."
   Memory: 15.8M
   CGroup: /system.slice/httpd.service
           ├─54573 /usr/sbin/httpd -DFOREGROUND
           ├─54576 /usr/sbin/httpd -DFOREGROUND
           ├─54577 /usr/sbin/httpd -DFOREGROUND
           ├─54578 /usr/sbin/httpd -DFOREGROUND
           ├─54579 /usr/sbin/httpd -DFOREGROUND
           └─54580 /usr/sbin/httpd -DFOREGROUND

Jun 05 15:57:34 tele-2 systemd[1]: Starting The Apache HTTP Server...
Jun 05 15:57:34 tele-2 systemd[1]: Started The Apache HTTP Server.

 

  4.那时您就足以访问你的服务器了,输入localhost或者ip地址,出现一个Apache
test page powered by centos的测试页面

 

 

bind() to 0.0.0.0:80 failed (98: Address already in use)  这是因为我之前安装了nginx已经占用了80端口并且正在运行端口发生冲突,

PHP

PHP

 

故而就要求修改httpd的端口号,配置文件地点/usr/local/httpd/conf/httpd.conf:

 

  1.php安装命令

[root@tele-2 ~]# yum install php

 

  2.直接一路设置,安装到位之后再也重启httpd服务

[root@tele-2 ~]# service httpd start
Redirecting to /bin/systemctl start  httpd.service

 

  3.重启之后大家举行测试PHP相关音讯,大家新建一个PHP界面进行测试

在apache默许页面路径/``var``/www/html下新建一个test.php页面,添加代码

<?php
 phpinfo();
?>

     

bf88必发唯一官网 5

 

  4.做客那么些页面,输入localhost/test.php,或者

ip:端口号/test.php就可以看见php环境的计划音讯了。如右图:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  1.php安装命令

[root@tele-2 ~]# yum install php

 

  2.一贯一路设置,安装到位之后再行重启httpd服务

[root@tele-2 ~]# service httpd start
Redirecting to /bin/systemctl start  httpd.service

 

  3.重启之后大家开展测试PHP相关新闻,我们新建一个PHP界面举行测试

在apache默许页面路径/``var``/www/html下新建一个test.php页面,添加代码

<?php
 phpinfo();
?>

     

bf88必发唯一官网 6

 

  4.造访那么些页面,输入localhost/test.php,或者

ip:端口号/test.php就足以望见php环境的布局音讯了。如右图:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

关联php和mysql

 

  1.摸索模块

[[email protected] ~]# yum search php

 

  2.设置相关模块

[[email protected] ~]# yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml  php-xmlrpc

 

  3.装置到位,重启mysqld,重启httpd

双重访问刚才的info.php,大家发现早已多了MySQL的有关信息。如右图:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   至此,php在linux中的运行条件就已经打响安顿完毕了。

 

  1.mysql yum设置默许文件夹及相关命令

数据库目录:/var/lib/mysql/

配置文件:/usr/share/mysql(mysql.server命令及配置文件)

相关命令:/usr/bin(mysqladmin mysqldump等命令)

my.cnf: /etc/my.cnf

启动脚本:/etc/rc.d/init.d/(启动脚本文件mysql的目录)

启动命令:service mysql start

停止命令:service mysql stop

运行状态:service mysql status

 

 

  2.apache

配置文件路径:/etc/httpd/conf/httpd.conf

启动命令:service httpd start

停止命令:service httpd stop

运行状态:service httpd status

 

 

  3.php

php默认页面路径:/var/www/html

 

 

 

有关链接:

 

linux下安插php项目环境得以分为两种,一种选拔Apache,php,mysql的压缩包安装,一种用yu…

vim /usr/local/httpd/conf/httpd.conf

 

 

搜索Listen 80将其改为Listen
8080(修改的端口号可以不管定义,范围是0~65535,其中0没有其余意义,也能够知道为1~65535),重启httpd提醒新的谬误:Could not reliably determine the server’s fully
qualified domain name,

 

 

那是因为httpd.conf中ServerName未修改,搜索ServerName,将其改为:ServerName
localhost:8080过后重新重启错误消失,查看一下正在运转的劳务:

关联php和mysql

 

  1.寻找模块

[root@tele-2 ~]# yum search php

 

  2.安装相关模块

[root@tele-2 ~]# yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml  php-xmlrpc

 

bf88必发唯一官网 7

  3.设置完结,重启mysqld,重启httpd

双重访问刚才的info.php,大家发现早已多了MySQL的连带新闻。如右图:

 

 

 

 

 

 

 

 

 

 

 

 

 

bf88必发唯一官网, 

 

 

 

 

 

 

 

 

   至此,php在linux中的运行条件就已经打响安插已毕了。

 

  1.mysql
yum设置默认文件夹及相关命令

数据库目录:/var/lib/mysql/

配置文件:/usr/share/mysql(mysql.server命令及配置文件)

相关命令:/usr/bin(mysqladmin mysqldump等命令)

my.cnf: /etc/my.cnf

启动脚本:/etc/rc.d/init.d/(启动脚本文件mysql的目录)

启动命令:service mysql start

停止命令:service mysql stop

运行状态:service mysql status

 

 

  2.apache

配置文件路径:/etc/httpd/conf/httpd.conf

启动命令:service httpd start

停止命令:service httpd stop

运行状态:service httpd status

 

 

  3.php

php默认页面路径:/var/www/html

 

 

 

有关链接:

 

关联php和mysql

 

  1.追寻模块

[root@tele-2 ~]# yum search php

 

  2.装置相关模块

[root@tele-2 ~]# yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml  php-xmlrpc

 

bf88必发唯一官网 8

  3.安装完毕,重启mysqld,重启httpd

重复访问刚才的info.php,我们发现已经多了MySQL的连锁音讯。如右图:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   至此,php在linux中的运行条件就曾经打响安顿已毕了。

 

  1.mysql
yum装置默许文件夹及有关命令

数据库目录:/var/lib/mysql/

配置文件:/usr/share/mysql(mysql.server命令及配置文件)

相关命令:/usr/bin(mysqladmin mysqldump等命令)

my.cnf: /etc/my.cnf

启动脚本:/etc/rc.d/init.d/(启动脚本文件mysql的目录)

启动命令:service mysql start

停止命令:service mysql stop

运行状态:service mysql status

 

 

  2.apache

配置文件路径:/etc/httpd/conf/httpd.conf

启动命令:service httpd start

停止命令:service httpd stop

运行状态:service httpd status

 

 

  3.php

php默认页面路径:/var/www/html

 

 

 

连带链接:

 

bf88必发唯一官网 9

 ps:上述安装的依靠版本并不是永恒的,在装置的时候最好到官网看一下文档表达,选择高档的本子,比如用apr-1.3.*的版本,用来编译安装httpd-2.4.*的apache的时候就编译不了了

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图