本篇文章给大家介绍一下centOS安装PHP后,php-fpm启动失败的解决方法。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。
在centOS6.8上安装php,出各种问题,光是gcc的版本太低,升级gcc这个,就让我气了两天,翻遍了几乎所有相关博客总算解决了。还有mysql安装也没少踩坑,所以大家还是尽量用centOS7吧,少生气能多活几年呢。。。
现在说一下centOS6.8上编译安装php7.2.1吧。
1,安装扩展包并更新系统(我在根目录下开始的):
1 2 |
|
2,安装php依赖组件(一段全复制上去,其实掠过也可能没关系):
yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel
3,下载php安装包并解压:
1 2 |
|
4,进入解压目录并开始编译(编译千万不能省,运行出错了就不能make了,这是我选出来的最靠谱可行的编译了):
1 |
|
./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-mcrypt=/usr/include --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache
5,为了安全保险的给make出来,先更新依赖库以防万一:
1 |
|
6,安装:
1 2 |
|
7,关于配置:
1 2 3 |
|
8,加个权限:
1 |
|
现在试一下,/etc/init.d/php-fpm start
如果php启动成功了,那你很幸福;如果失败了,接着往下看。
大概出现的是下图这个情况吧?
再试一下运行提示的命令,出的问题是ERROR:FPM initialization failed.如下图:
所以出问题的是php-fpm,机智如我,把我另一个虚拟机(centOS7)上的php-fpm给换上去了,只需要把php的安装根目录按照自己的情况改一下就成了(就是这一行:prefix=/usr/local/php)。现在我就无私的把我的php-fpm文件奉献出来。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
Das obige ist der detaillierte Inhalt vonWas soll ich tun, wenn php-fpm nach der Installation von PHP auf centOS nicht startet?. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!