centos7.6,nginx1.18,php-7.4.6,mysql-5.7.30 安装

#1、下载,来自各官网

nginx-1.18.0.tar.gz

php-7.4.6.tar.gz

mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz

#下载到本地再传到服务器,比直接wget快

 

#2、准备工作

yum install -y libxml2 libxml2-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel

yum install libsqlite3x-devel -y
yum install oniguruma-devel -y
yum install -y gcc gcc-c++ openssl-devel
yum install pcre pcre-devel zlib zlib-devel -y

groupadd www
useradd -M -s /sbin/nologin www
#centos7已改为
useradd -g www -s /sbin/nologin www groupadd mysql useradd -M -s /sbin/nologin mysql
#openssl升级安装 #参考 https://www.cnblogs.com/itbsl/p/11275728.html #php7 编译需要高本版zlib,libzip >= 0.11 #libzip-1.2.0.tar.gz #libzip-1.6X需要高版本cmake,我机器安装报错就没有用 cd libzip-1.2.0 ./configure make && make install #在网上找到的教程到了这一步就直接让你继续在PHP源码目录里面执行configure程序继续配置了,其实你虽然已经安装了libzip1.2,但是PHP的configure程序依然找不到,不知道你安装在哪,你得告诉PHP的configure程序,我安装了libzip 1.2,并且安装在何处。以前是用ldconfig来通告系统所需动态库文件的位置,现在用pkg-config。我刚刚提供的方法安装的libzip默认被安装到了 /usr/local/lib 在这个目录下你能看到libzip.so libzip.so.5 libzip.so.5.0.0 还有一个pkgconfig目录。所以,真正的解决方法来了,在你configure的会话窗口直接输入如下内容: export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" #参考:https://www.cnblogs.com/equation/p/12352596.html #tools 解压目录 #nginx 安装 #参考 https://blog.csdn.net/nouswait/article/details/83105378 #https://blog.csdn.net/qq_42303254/article/details/87886098 cd /opt/nginx/tools/nginx-1.8.0 ./configure --user=www --group=www --prefix=/opt/ngin make && make install #php 安装 cd php ./configure --prefix=/opt/php --with-config-file-path=/etc --with-fpm-user=www --with-fpm-group=www --with-curl --with-freetype --enable-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --with-jpeg --with-zip --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-fpm #php 安装参考 https://hqidi.com/150.html https://www.cnblogs.com/liubaoqing/p/12176017.html #mysql 安装 #参考https://www.cnblogs.com/haima/p/12276063.html ./mysqld –initialize --defaults-file=/etc/my.cnf --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql #data 为数据文件夹 chown -R mysql:mysql data #授权my.cnf chown 777 /etc/my.cnf #复制启动脚本到资源目录 cp -a /opt/mysql/support-files/mysql.server /etc/init.d/mysqld #增加mysqld服务控制脚本执行权限 chmod +x /etc/init.d/mysqld #将mysqld服务加入到系统服务 chkconfig --add /etc/init.d/mysqld /opt/mysql/bin/mysqld_safe --user=mysql & #启动mysql服务 /etc/init.d/mysqld restart #显示默认密码 cat /root/.mysql_secret #登录并修改密码,省略 #mysql 安装参考 https://blog.csdn.net/ahangliu/article/details/106476385 #linux系统下将php和mysql命令加入到环境变量中的方法 PATH=$PATH:/opt/php/bin:/opt/mysql/bin export PATH #加入开机启动php [Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] Type=simple PIDFile=/run/php-fpm.pid ExecStart=/opt/php/sbin/php-fpm --nodaemonize --fpm-config /opt/php/etc/php-fpm.conf ExecReload=/bin/kill -USR2 $MAINPID ExecStop=/bin/kill -SIGINT $MAINPID [Install] WantedBy=multi-user.target #加入开机启动nginx [Unit] Description=nginx - high performance web server After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/opt/nginx/sbin/nginx ExecReload=/opt/nginx/sbin/nginx -s reload ExecStop=/opt/nginx/sbin/nginx -s stop [Install] WantedBy=multi-user.target #加入开机启动mysql,我没有使用 [Unit] Description=MySQL Server Documentation=man:mysqld(8) After=network.target After=syslog.target [Install] WantedBy=multi-user.target [Service] User=mysql Group=mysql ExecStart=/opt/mysql/bin/mysqld --defaults-file=/etc/my.cnf LimitNOFILE = 5000 #Restart=on-failure #RestartPreventExitStatus=1 #PrivateTmp=false #开机启动参考 https://www.cnblogs.com/yingsi/p/8482639.html https://www.cnblogs.com/onephp/p/6093707.html https://www.cnblogs.com/shiqiangqiang/p/8398931.html #mysql 配置参考 https://www.cnblogs.com/kanyun/p/8075414.html #Mysql5.5&Mysql5.6&Mysql5.7特性 https://blog.csdn.net/zxz547388910/article/details/78671911 #vim 中批量添加注释 https://blog.csdn.net/yzs_110/article/details/90643327

############centos 7 php5.6 编译安装################  

#下载
地址:
https://www.php.net/releases/index.php
搜索 5.6
tar -zxvf php-5.6.40.tar.gz
cd php-5.6.40

#执行前置安装
yum install -y libxml2 libxml2-devel libicu libicu-devel openldap openldap-devel  libxslt-devel  freetype*  libjpeg* libpng*

#编译
./configure --prefix=/opt/php56 --with-config-file-path=/etc --with-fpm-user=www --with-fpm-group=www --with-curl --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64  --with-mysql --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --with-freetype-dir=/usr/include/freetype2 --enable-gd-native-ttf  --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --enable-zip --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-fpm

# freetype yum 安装在了 /usr/include/freetype2  可通过 find / -name freetype 查看,其他类同

#安装
make && make  install

#如果出现这个错误 先清除下再重新编译 和安装
libtool: link: `ext/opcache/ZendAccelerator.lo' is not a valid libtool object
#解决办法:
make distclean

#配置
cp -a php.ini-production /opt/php56/etc/php.ini
rm /etc/php.ini -rf
ln -s /opt/php56/etc/php.ini /etc/php.ini

cp sapi/fpm/php-fpm.conf /opt/php56/etc/
cp -a sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
#改执行权限
chmod +x /etc/init.d/php-fpm

#启动
/etc/init.d/php-fpm start
或
service php-fpm start

  

参考 :感谢

https://blog.csdn.net/stacy06/article/details/84032985

https://www.cnblogs.com/bigcatking/p/5340609.html

https://blog.csdn.net/chen55bo/article/details/71172463

 

 

500 无输出 不报错 请问如何快速定位错误代码

万能代码

register_shutdown_function(function(){ var_dump(error_get_last()); });

 

posted @ 2020-06-05 17:22  coolid  阅读(594)  评论(0编辑  收藏  举报