PHP编译apache模块
今天打算把apache的运行PHP由php54改为php7,发现服务器上服务器上编译的php7没有libphp7.so,就下载了php72,准备重新编译,编译前搜了一下,发现如果需要libphp7.so,必须写上 --with-apxs2。
执行 ./configure ,报错:
checking for Apache 2.0 handler-module support via DSO through APXS...
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2
3. Apache was not built using --enable-so (the apxs usage page is displayed)
搜了一下,按提示写上路径,--with-apxs2=/path/to/apxs ,本地服务器的/usr/local/sinasrv2/bin/apxs,再次执行 ./configure 通过!
附带写上 ./configure 的比较全的参数。 如下:
./configure --prefix=/usr/local/php72 --exec-prefix=/usr/local/php72 --bindir=/usr/local/php72/bin --sbindir=/usr/local/php72/sbin --includedir=/usr/local/php72/include --libdir=/usr/local/php72/lib/php --mandir=/usr/local/php72/php/man --with-config-file-path=/usr/local/php72/etc --with-mysql-sock=/tmp/mysql.sock --with-mcrypt --with-apxs2=/*******/bin/apxs --with-mhash --with-openssl --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --without-gdbm --enable-fast-install --disable-fileinfo
PS:
1. mcrypt扩展在php7.2 弃用.在phh7.1时,官方就开始建议用openssl_*系列函数代替Mcrypt_*系列的函数
2. gd-native-ttf在php7.2 弃用