标签:config bash linux环境 echo php脚本 启动 iad soc monit
【部署Linux环境】
[root@chaogelinux ~]# iptables -F [root@chaogelinux ~]# systemctl stop firewalld [root@chaogelinux ~]# systemctl disable firewalld [root@chaogelinux ~]# getenforce Disabled
【部署apache】
[root@chaogelinux ~]# systemctl start httpd [root@chaogelinux ~]# systemctl status httpd
【部署mysql(mariadb)】
[root@chaogelinux ~]# yum install mariadb-server mariadb [root@chaogelinux ~]# systemctl start mariadb
检查mariadb的数据文件,存在mysql.sock文件,表示启动成功了,以及其属主,属组权限。
[root@chaogelinux ~]# ls -l /var/lib/mysql/ 总用量 28700 -rw-rw----. 1 mysql mysql 16384 2月 3 17:37 aria_log.00000001 -rw-rw----. 1 mysql mysql 52 2月 3 17:37 aria_log_control -rw-rw----. 1 mysql mysql 18874368 2月 3 17:37 ibdata1 -rw-rw----. 1 mysql mysql 5242880 2月 3 17:37 ib_logfile0 -rw-rw----. 1 mysql mysql 5242880 2月 3 17:34 ib_logfile1 drwx------. 2 mysql mysql 4096 2月 3 17:34 mysql srwxrwxrwx. 1 mysql mysql 0 2月 3 17:37 mysql.sock drwx------. 2 mysql mysql 4096 2月 3 17:34 performance_schema drwx------. 2 mysql mysql 6 2月 3 17:34 test
登录mariadb数据库
[root@chaogelinux ~]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.64-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. MariaDB [(none)]>
设置mariadb用户root的密码
[root@chaogelinux ~]# mysqladmin -uroot password "chaoge666" 再次登录必须输入正确密码 [root@chaogelinux ~]# mysql -uroot -pchaoge666
【部署php】
1.解决php安装的依赖开发环境 yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libtool-ltdl-devel pcre pcre-devel apr apr-devel zlib-devel gcc make -y 2.安装php,以及php连接mysql数据库的驱动 [root@chaogelinux ~]# yum install php php-fpm php-mysql -y 3.php不需要额外修改,但是需要修改apache配置文件,支持php [root@chaogelinux ~]# cat /etc/httpd/conf/httpd.conf #添加如下相关配置 DocumentRoot "/www" TypesConfig /etc/mime.types AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps DirectoryIndex index.php index.html 4.修改首页文件内容 [root@chaogelinux ~]# cat /www/index.php <meta charset=utf8> 我是新的首页,你好兄弟们 <?php phpinfo(); ?> 5.启动php进程 systemctl start php-fpm
【测试php连接mysql】
1.添加php脚本 [root@chaogelinux www]# cat /www/chaoge.php <?php $conn = mysql_connect(‘localhost‘,‘root‘,‘chaoge666‘); if ($conn) echo "php已成功连接mysql,你真棒"; else echo "你咋回事,这都搞不定,细心检查下吧"; mysql_close(); ?>
标签:config bash linux环境 echo php脚本 启动 iad soc monit
原文地址:https://www.cnblogs.com/abc1234567/p/14162289.html