Home >Backend Development >PHP Tutorial >PHP不是识别OneThink的验证码-解决翻案

PHP不是识别OneThink的验证码-解决翻案

WBOY
WBOYOriginal
2016-06-23 13:58:53972browse

环境:centos6.4(64位) 、Apache/2.2.24 (Unix)  、 PHP/5.4.21
问题:新项目(用的OneThink为框架)验证码无法显示,提示缺少freetype.

解决方案:重新安装php

具体步骤如下:

PHP安装
要考虑安装SVN所需的东西(Apache),OneThink的东西

1.安装依赖项 yum install perl yum install libxml2 yum install libxml2-devel yum install libjpeg libjpeg-devel yum install libpng-devel yum install freetype-devel yum install gd-devel yum install curl curl-devel 2.配置源码 cd ~/src   //转到存放源代码压缩包的目录中。 tar zxvf php-5.3.13.tar.gz cd php-5.3.13/ ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-gd --with-zlib --with-jpeg-dir=/usr/lib64/ --with-png-dir=/usr/lib64/ --with-freetype-dir=/usr/lib64/ --enable-gd-native-ttf --enable-sockets --with-iconv --enable-mbstring --with-config-file-path=/usr/local/php5/etc --enable-zlib=/usr/lib64/  --enable-zip --with-curl  --with-xpm-dir=/usr/lib64/make make install cp php.ini-production  /usr/local/php5/etc/php.ini 3.重启Apache服务器,使用phpinfo查看php是否安装成功。 service apache2 restart 在默认的网站目录中,新建php文件,然后用web browser 或者wget测试 (如果curl没有开启,请检查php.ini 文件是否存在 extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/" extension = curl.so 不存添加即可)



编译时会出现如下错误:

checking for jpeg_read_header in -ljpeg... yesIf configure fails try --with-vpx-dir=<dir>checking for png_write_image in -lpng... yesconfigure: error: libXpm.(a|so) not found.</dir>

原因:

configure一般的搜索编译路径为/usr/lib/下,因为php默认就在/usr/lib/下找相关库文件  (摘自网上)

解决方案:

主机是x64平台,
  ln -s  /usr/lib64/libXpm.so*   /usr/lib/

  并且编译时指定,  --with-xpm-dir=/usr/lib64/x11

./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-gd --with-zlib --with-jpeg-dir=/usr/lib64/ --with-png-dir=/usr/lib64/ --with-freetype-dir=/usr/lib64/ --enable-gd-native-ttf --enable-sockets --with-iconv --enable-mbstring --with-config-file-path=/usr/local/php5/etc --enable-zlib=/usr/lib64/  --enable-zip --with-curl  --with-xpm-dir=/usr/lib64/x11





之后就不会出现错误,运行make和make install 即可安装,如果是重新安装不许要配置php.ini的话,可以不用执行

cp php.ini-production  /usr/local/php5/etc/php .ini



昨天晚上折腾了好久,终于折腾好了,之后OneThink的验证码就可以正常显示了。







Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn