php without-mysql_PHP安装报mysql错及php-fpm启动faild

报错信息如下:

configure: error: Cannot find MySQL header files under /usr/local/mysql

编译安装PHP5.5.38

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/data/mysql/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-zlib-dir=/usr/local/zlib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --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-mcrypt --with-curl --enable-ctype

报错:

configure: error: Cannot find MySQL header files under /usr/local/mysql.

如果不知道mysql安装位置,可使用mysqlnd代替

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pdo-mysql=mysqlnd --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-zlib-dir=/usr/local/zlib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --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-mcrypt --with-curl --enable-ctype

其中配置with-mysql-sock:

--with-mysql-sock=/var/lib/mysql/mysql.sock

登录mysql后执行STATUS命令可查看到UNIX socket

mysql>STATUS--------------mysql Ver14.14 Distrib 5.6.37, forLinux (x86_64) using EditLine wrapper

Connectionid: 2503Current database:

Current user: root@localhost

SSL: Notinuse

Current pager: stdout

Using outfile:''Using delimiter: ;

Server version:5.6.37MySQL Community Server (GPL)

Protocol version:10Connection: Localhost via UNIX socket

Server characterset: utf8mb4

Db characterset: utf8mb4

Client characterset: utf8mb4

Conn. characterset: utf8mb4

UNIX socket:/var/lib/mysql/mysql.sock

Uptime:24 days 10 hours 32 min 15sec

Threads:21 Questions: 9435046 Slow queries: 4 Opens: 1640 Flush tables: 1 Open tables: 431 Queries per second avg: 4.468

--------------mysql>

如果启动php-fpm失败,但已是启动成功的:

> /etc/init.d/php-fpm start

Starting php-fpm ................................... failed

则需要查看/usr/local/php/etc/php-fpm.conf文件配置:

[global]

; Pidfile; Note: the default prefix is/usr/local/php/var

; Default Value: none

pid= run/php-fpm.pid

查看php-fpm.pid文件是否存在,不存在则创建一个空的php-fpm.pid文件,

并且查看是否与启动文件/etc/init.d/php-fpm的php-fpm.pid文件路径一致。

prefix=/usr/local/php

exec_prefix=${prefix}

php_fpm_BIN=${exec_prefix}/sbin/php-fpm

php_fpm_CONF=${prefix}/etc/php-fpm.conf

php_fpm_PID=${prefix}/var/run/php-fpm.pid

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值