Heim > Artikel > Backend-Entwicklung > php安装中出现的有关问题解决
php安装中出现的问题解决
php安装:
1./configure --prefix=/usr/local/php --with-apxs2=/home/apache/bin/apxs --with-zlib-dir --with-libxml-dir=/usr/local/libxml2/ --with-gd --with-freetype --with-jpeg --with-png --enable-mbstring --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-gd-native-ttf --with-gettext=/usr/local/gettext/ --enable-magic-quotes --enable-sockets
需要php支持图片需要gd库
由于操作系统自带了gd png jpeg 库等,没法指定dir 直接用--with-jpeg这样的形式。
2.make install时出现以下错误:
Installing PHP SAPI module: apache2handler
/usr/share/apache2/build/instdso.sh SH_LIBTOOL='/usr/share/apr-1.0/build/libtool' libphp5.la /usr/lib/apache2/modules
/usr/share/apr-1.0/build/libtool --mode=install cp libphp5.la /usr/lib/apache2/modules/
libtool: install: cp .libs/libphp5.so /usr/lib/apache2/modules/libphp5.so
libtool: install: cp .libs/libphp5.lai /usr/lib/apache2/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /home/hcc/php-5.2.13/libs'
chmod 644 /usr/lib/apache2/modules/libphp5.so
apxs:Error: Activation failed for custom /etc/apache2/httpd.conf file..
apxs:Error: At least one `LoadModule' directive already has to exist..
make: *** [install-sapi] Error 1
实际上httpd.conf已经存在。不知道为什么出现以上错误,采用了以下方法,先备份httpd.conf
然后重新建一个httpd.conf
内容
#LoadModule directive to aid module installations
#LoadModule dummy_module /usr/lib/apache2/modules/mod_dummy.so
这样就成功安装
3.解决了php安装后,发现php不支持jpeg,但是在上述的配置过程中已经加上了--with-jpeg,并且libjpeg的rpm也是安装的,但是始终是无法支持,只好重新安装jpeg库
下载jpegv6
ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/jpeg-6b.tar.gz
编译安装:./configure --prefix=/usr/local/jpeg --enable-shared
然后在安装php
/configure --prefix=/usr/local/php --with-apxs2=/home/apache/bin/apxs --with-zlib-dir --with-libxml-dir=/usr/local/libxml2/ --with-gd --with-freetype --with-jpeg-dir=/usr/local/jpeg --with-png --enable-mbstring --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-gd-native-ttf --with-gettext=/usr/local/gettext/ --enable-magic-quotes --enable-sockets
重新编译安装即可支持jpeg