欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

centos7.4安装php5.6套件

程序员文章站 2022-07-13 14:35:57
...
本文不包括清理系统原有环境里的nginx,php,mysql
所谓套件,就是nginx,php5.6,mysql5.7,redis

# 操作系统 centos7.4

yum install -y wget epel-release
yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
注意:如果是centos6,则
yum install -y http://rpms.remirepo.net/enterprise/remi-release-6.rpm

yum install -y yum-utils
  
yum-config-manager --enable remi-php56
  
yum install -y nginx php56 redis
  
yum install -y php56-php-devel  php56-php-fpm  php56-php-mbstring php56-php-memcache php56-php-redis  php56-php-mysqli php56-php-mysqlnd  php56-php-pdo  php56-php-bcmath php56-php-dom php56-php-gd php56-php-gmp php56-php-igbinary php56-php-imagick   php56-php-mcrypt  php56-php-pdo_mysql php56-php-posix php56-php-simplexml  php56-php-opcache php56-php-xsl php56-php-xmlwriter php56-php-xmlreader php56-php-xml php56-php-swoole php56-php-zip

ln -s /usr/bin/php56 /usr/bin/php
ln -s /opt/remi/php56/root/sbin/php-fpm /usr/bin/php-fpm



vi /etc/opt/remi/php56/php-fpm.d/www.conf

~~~
# user=apche, group=apache改成
user = nginx
group = nginx
~~~

vi /etc/nginx/default.d/default.conf
~~~
    ## enable php support ##
    location ~ \.php$ {
        root /usr/share/nginx/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        include        fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }
~~~

vi /usr/share/nginx/html/phpinfo.php
~~~
<?php
phpinfo();
~~~



systemctl enable php56-php-fpm.service
systemctl start php56-php-fpm


systemctl start nginx

# 打开浏览器
http://127.0.0.1/phpinfo.php






# 下面一大段 mysql 5.7
wget http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm
rpm -Uvh mysql57-community-release-el7-7.noarch.rpm
yum install mysql-server
systemctl start mysqld

# 这一步查看到初始密码
grep "password" /var/log/mysqld.log

# 这一步输入刚才的初始密码
mysql -uroot -p
 
  # 以下语句在mysql的shell里执行,最后一句是设置密码
  set global validate_password_policy=0;
  set global validate_password_mixed_case_count=0;
  set global validate_password_number_count=3;
  set global validate_password_special_char_count=0;
  set global validate_password_length=3;
  SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123');

  # 下面这句话去除 mysql在yum仓库的记录,避免每次更新。
yum -y remove mysql57-community-release-el7-7.noarch 

# 这句话查看mysql的安装配置
# mysql_config
systemctl stop mysqld
systemctl start mysqld



相关标签: centos7 php5.6