您的位置:首页 > 编程语言 > PHP开发

编译php可能遇到的问题和解决方法

2018-01-25 15:13 501 查看
在编译php7.1.13的时候,出现了一些问题,编译参数如下:

[root@linux-node1 php-7.1.13]# ./configure --prefix=/usr/local/php \
--disable-debug \
--disable-phpdbg \
--enable-mysqlnd \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--with-curl \
--enable-exif \
--enable-fpm \
--with-freetype-dir \
--enable-ftp \
--with-gd \
--enable-gd-jis-conv \
--enable-gd-native-ttf \
--with-gettext=/usr \
--with-gmp=/usr/include/linux \
--with-iconv \
--enable-intl \
--with-jpeg-dir \
--enable-mbstring \
--with-mcrypt \
--with-openssl \
--enable-pcntl \
--with-pdo-mysql=mysqlnd \
--with-png-dir \
--with-recode=/usr \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-xmlrpc \
--with-xsl \
--with-zlib=/usr \
--enable-zip \
--with-mysqli=mysqlnd

[root@linux-node1 php-7.1.13]# make ZEND_EXTRA_LIBS='-liconv'
[root@linux-node1 php-7.1.13]# make install


针对这些问题,写出了相应的方法:

1、xpm.h not found
$ yum -y install libXpm-devel   #注意x为大写
$ yum -y install libXext-devel  #注意x为大写

2、Unable to locate gmp.h(/usr/include/gmp.h)
$ yum -y install gmp gmp-devel
备注:路径应该在/usr/include/gmp.h,如果不在/usr/include/目录下,可以做一个软链接

3、error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen
$yum -y install libc-client-devel

4、error: Unable to detect ICU prefix or /usr/bin/icu-config failed
$ yum -y install  libicu* icu*

5、error: ODBC header file '/usr/include/sqlext.h' not found
$ yum -y install unixODBC-devel

6、error: Cannot find pspell
$ yum -y install aspell-devel

7、configure: error: Can not find recode.h anywhere under /usr /usr/local /usr /opt.
$ yum -y install recode recode-devel

8、error: Could not find net-snmp-config binary
$ yum -y install net-snmp-devel

9、error: Cannot find libtidy
$ yum -y install libtidy-devel


以下是自己针对php的一些相关配置

1、php.ini 添加如下内容:

engine = On
short_open_tag = Off
realpath_cache_size = 2M
max_execution_time = 86400
memory_limit = 1024M
error_reporting = 0
display_errors = 0
display_startup_errors = 0
log_errors = 0
default_charset = "UTF-8"

[opcache]
zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.fast_shutdown=1
opcache.validate_timestamps=1
opcache.revalidate_freq=60
opcache.use_cwd=1
opcache.max_accelerated_files=100000
opcache.max_wasted_percentage=5
opcache.memory_consumption=128
opcache.consistency_checks=0
opcache.huge_code_pages=1

// PHP 8/Next only
opcache.jit=35
opcache.jit_buffer_size=32M


2、在/usr/local/php/etc/php-fpm.d/www.conf的配置

[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice

[www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = static
pm.max_children = 300
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 10240
rlimit_files = 51200
request_terminate_timeout = 300
request_slowlog_timeout = 0
slowlog = var/log/slow.log
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: