1、centos7 安装PHP7.2版本 #查询是否安装过php yum list installed | grep php yum provides php #移除php yum remove php-common #下载源 rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum install php72w php72w-opcache php72w-xml php72w-gd php72w-devel php72w-mysql php72w-intl php72w-mbstring php72w-fpm php72w-cli php72w-mbstring php72w-pdo php-redis php -v #PHP 7.2.14 #设置时区 vim /etc/php.ini date.timezone = "Asia/Shanghai" #设置php-fpm运行用户组 vim /etc/php-fpm.d/www.conf user = nginx group = nginx listen.owner = nobody 前面;去掉 listen.group = nobody 前面;去掉 listen.mode = 0660 前面;去掉 #启动php-fpm systemctl start php-fpm.service systemctl status php-fpm.service systemctl stop php-fpm.service systemctl restart php-fpm.service #设置开机自启动 systemctl enable php-fpm.service #安装mcrypt扩展 #mcrypt扩展从php7.1.0开始废弃,自php7.2.0起会移到pecl #http://pecl.php.net/package/mcrypt yum install gcc libmcrypt libmcrypt-devel mcrypt mhash wget http://pecl.php.net/get/mcrypt-1.0.1.tgz tar -zxvf mcrypt-1.0.1.tgz cd mcrypt-1.0.1 #whereis phpize /usr/bin/phpize #whereis php-config ./configure --with-php-config=/usr/bin/php-config && make && make install #vim php.ini extension=mcrypt.so #重启php-fpm systemctl restart php-fpm.service
2、nginx安装 yum install nginx #http 对象中修改 #log_format 前的#去掉 #添加 client_max_body_size 200m; #添加 include /usr/local/nginx/conf/conf.d/*.conf; #项目的http配置文件可以放到conf.d文件夹中了 #设置开机自启动 systemctl enable nginx.service
3、redis安装 yum install redis #启动redis systemctl start redis.service systemctl status redis.service systemctl stop redis.service systemctl restart redis.service #设置开机自启动 systemctl enable redis.service
4、mysql5.7.20安装 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm #安装mysql源 yum localinstall mysql57-community-release-el7-8.noarch.rpm #安装mysql server yum install mysql-community-server #启动mysqld systemctl start mysqld.service systemctl status mysqld.service systemctl enable mysqld.service #查看临时密码 grep 'A temporary password' /var/log/mysqld.log #登录设置root新密码 alter user 'root'@'localhost' identified by 'Abc123!@#';
5、php_screw-1.5 扩展编译 #进入http://sourceforge.net/projects/php-screw/下载最新版本php_screw-1.5.tar.gz #cd /home/tools tar -zxvf php_screw-1.5.tar.gz cd php_screw-1.5 #更改加密策略 vim php_screw.h #修改 define PM9SCREW “ PHPSCREW ” vim my_screw.h #数组中数据随便修改,但最多保持在5位数 vim php_screw.c #CG(extended_info) = 1; 修改为 CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO; /usr/bin/phpize ./configure --with-php-config=/usr/bin/php-config make && make install #编译会在/home/tools/php_screw-1.5/modules文件夹 #/usr/lib64/php/modules/文件夹生成php_screw.so文件 #php.ini添加extension=php_screw.so vim /etc/php.ini systemctl restart php-fpm.service #生成加密二进制文件screw cd /home/tools/php_screw-1.5/tools make #make生成二进制文件screw cp screw /usr/bin/screw #接下来就玩起来吧