Cet article vous présente comment déployer l'environnement de projet PHP sous le système Linux. Il a une certaine valeur de référence. Les amis dans le besoin peuvent s'y référer. J'espère qu'il vous sera utile.
L'environnement de déploiement de projets PHP sous Linux peut être divisé en deux types, l'un est installé à l'aide du package compressé d'Apache, PHP et MySQL, et l'autre est installé à l'aide de la commande yum.
Utilisez les packages compressés des trois logiciels à installer, et vous devez configurer manuellement la relation entre les trois. La configuration entre Apache et php n'est pas difficile, mais lors de la configuration avec MySQL, vous devez comprendre php.
1 .mysql et apache sont mieux installés en premier, car lors de la configuration de php, ils doivent être configurés et testés en conjonction avec mysql et apache
Téléchargez d'abord le fichier mysql-sever, car l'environnement Linux du blogueur est la version CentOS. Il ne semble pas y avoir de fichier mysql-sever pour l'installation normale de mysql dans la source yum. Vous devez le télécharger depuis le site officiel
1.下载mysql-service文件 [root@tele-1 ~]# wget mysql-service [root@tele-1 ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
2. Installez mysql
<🎜. >[root@tele-1 ~]# yum install mysql-community-server
[root@tele-1 ~]# service mysqld restart
1.进入mysql命令行 [root@tele-1 ~]# mysql -urootWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 474801Server 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)
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 changedmysql> <br><span style="font-family: 楷体; font-size: 14px"> 2.查看user表中的数据(在mysql命令行中可以直接进行sql语句编写)</span> 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 ???
mysql> \q Bye
[root@tele-2 ~]# yum install httpd
1. 🎜>
2. Visitez l'adresse dans la machine virtuelle, nous devons modifier le fichier de configuration d'Apache /etc/httpd/conf/httpd.conf
Rechercher #ServerName www .example.com:80 Remplacez ServerName localhost:80 Comme indiqué à droite :
[root@tele-2 ~]# service httpd startRedirecting to /bin/systemctl start httpd.service [root@tele-2 ~]# service httpd statusRedirecting 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.
[root@tele-2 ~]# yum install php
[root@tele-2 ~]# service httpd startRedirecting to /bin/systemctl start httpd.service
/
Créez une nouvelle page test.php sous le chemin de la page par défaut d'Apache var
/www/html
<?php phpinfo();?>
[root@tele-2 ~]# yum search php
[root@tele-2 ~]# yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
/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
配置文件路径:/etc/httpd/conf/httpd.conf service httpd start service httpd stop 运行状态:service httpd status
php默认页面路径:/var/www/html
Analyse de la syntaxe du moteur de modèles TAL en PHP (code)
Introduction à la mise à niveau de PHP7 pour faire fonctionner MongoDB
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!