<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[编译php支持curl和pdo_mysql---for cURL in default path... not found]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Thu, 19 Aug 2010 08:48:42 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	　　安装curl<br/>　　<br/>　　<br/>　　1. curl 是 php 標準庫,所以可以在原來的 phpX.X.X.tar.gz 中找到。<br/>　　2. 進入 php 目錄中的 ext 找到 curl<br/>　　3. 在 curl 目錄中執行 /usr/local/php5-fastcgi/bin/phpize<br/>　　4. 再來將他生成的檔案進行 ./configure –with-php-config=/usr/local/php5-fastcgi/bin/php-config<br/>　　5. 再來就是 make<br/>　　6. 再來也就是 make install<br/>　　7. 因為現在已經安裝了 curl.so<br/>　　8. 所以就要在 php.ini 中加入 extension ＝ curl.so<br/>　　9. 重啟 Web Server ?<br/>　　10.最後應該使用 就可以看到成功安裝?<br/>　　<br/>　　##############################################################################<br/>　　安装cURL<br/>　　 # wget http://curl.haxx.se/download/curl-7.17.1.tar.gz<br/>　　 # tar -zxf curl-7.17.1.tar.gz<br/>　　 # ./configure --prefix=/usr/local/curl<br/>　　 # make; make install<br/>　　安装php<br/>　　 只要打开开关 --with-curl=/usr/local/curl<br/>　　 就可以了。<br/>　　<br/>　　###############################################################################<br/>　　<br/>　　安装pdo-mysql<br/>　　原来编译php的时候，没有把dpo_mysql相关的参数带上，安装完后才发现。再重新编译有点费时间，所以决定单独来安装。<br/>　　先到http://pecl.php.net/找需要的版本，我用的是稳定的版本。要先看看说明，特别是要注意mysql的php的版本。<br/>　　wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz<br/>　　tar xzvf PDO_MYSQL-1.0.2.tgz<br/>　　cd PDO_MYSQL-1.0.2<br/>　　/usr/local/php/bin/phpize<br/>　　Configuring for:<br/>　　PHP Api Version: 20041225<br/>　　Zend Module Api No: 20060613<br/>　　Zend Extension Api No: 220060519<br/>　　./configure --with-php-config=/usr/local/php/bin/php-config<br/>　　经过configure就可以make了<br/>　　make<br/>　　make install<br/>　　注意pdo_mysql的全路径，我的是：<br/>　　/usr/local/php/lib/php/extensions/debug-non-zts-20060613/pdo_mysql.so<br/>　　然后在/usr/local/lib/php.ini<br/>　　加上一句：<br/>　　extension=/usr/local/php/lib/php/extensions/debug-non-zts-20060613/pdo_mysql.so<br/>　　重新启动apache即可看到已经加载pdo_mysql成功。<br/><div class="code"><br/>&#91;~/webserver/php/php-5.2.6/ext/curl&#93;# /usr/local/php/bin/phpize <br/>Configuring for:<br/>PHP Api Version:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20041225<br/>Zend Module Api No:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20060613<br/>Zend Extension Api No:&nbsp;&nbsp; 220060519<br/>&#91;~/webserver/php/php-5.2.6/ext/curl&#93;# ./configure -with-php-config=/usr/local/php/bin/php-config<br/></div><br/><br/><br/>1．找到当前运行的php版本的源代码目录。进入curl扩展库目录。<br/><br/>[root@vnegar ~]# cd /usr/local/src/php-5.2.11/ext/curl<br/><br/>2．调用phpize程序生成编译配置文件。<br/><br/>[root@vnegar curl]# /usr/local/php/bin/phpize<br/><br/>3．编译扩展库，分别执行下面的configure和make命令。<br/><br/>[root@vnegar curl]# ./configure --with-php-config=/usr/local/php/bin/php-config<br/><br/>报错如下： checking for cURL in default path... not found configure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/<br/><br/>解决办法：yum -y install curl-devel<br/><br/>make: make成功执行后，生成的扩展库文件在当前目录的modules子目录下<br/><br/>[root@vnegar curl]# make test Build complete. Don&#039;t forget to run &#039;make test&#039;. ERROR: Cannot run tests without CLI sapi.<br/><br/>4．配置php.ini文件在php.ini文件中找到设置扩展目录的位置，然后将扩展路径设置到apache2 modules目录下。<br/><br/>extension_dir = “/usr/local/apache2/modules/”<br/><br/>vi /usr/local/php/etc/php.ini<br/><br/>将 ; Directory in which the loadable extensions (modules) reside. extension_dir = &quot;./&quot;<br/><br/>改为： ; Directory in which the loadable extensions (modules) reside. extension_dir = &quot;/usr/local/apache2/modules/&quot;<br/><br/>##在php.ini的添加扩展库位置，设置要添加的扩展库。extension=curl.so<br/><br/>##以后如果还要添加别的扩展库的话，则只需先将php扩展库编译好，然后copy到apache2 modules目录下 ##然后再在这个位置，添加一行将编译后的扩展库文件名加上即可。<br/><br/>5．重启apache，查看phpinfo信息，即可看到刚才添加进去的curl扩展库。<br/><br/>结果还是出错，只好下载curl-7.19.3.tar.bz2，解压后编译，然后再编译php，提示<br/>configure: error: libjpeg.(a&#124;so) not found.<br/>那就下载libjpeg，<br/>wget http://www.ijg.org/files/jpegsrc.v8.tar.gz<br/>注意不要下载那个windows版本，即jpegsr8.zip。然后编译安装，现在提示<br/>configure: error: libpng.(a&#124;so) not found.<br/>下载libpng，注意不要下载zip版本，否则./configure时会出现<br/>-bash: ./configure：/bin/sh^M：损坏的解释器: 没有该文件或目录<br/><br/>今天配置一台server的php支持curl的时候, 出现如下报错<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;checking for cURL in default path... not found<br/>&nbsp;&nbsp;&nbsp;&nbsp;configure: error: Please reinstall the libcurl distribution -<br/>&nbsp;&nbsp;&nbsp;&nbsp;easy.h should be in /include/curl/<br/><br/>其实就是curl的dev包没有安装, 解决方案:<br/>终端下<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;# yum -y install curl-devel<br/><br/>然后就可以继续了<br/><br/><br/><br/>在Wordpress中启用插件Flickr Photo Album for WordPress时，需要系统支持cURL。<br/>大多数资料里都是比较简单的方法，即在编译php时加上cURL支持<br/>但由于我的系统里已经安装有php，并且有一些其他配置，重新安装太麻烦<br/>于是找到了这篇《linux php 扩展库编译》，验证通过，转载以记录一下<br/>以php curl 扩展库编译为例。<br/><br/>假如原先编译的php目录在/oracle/php4目录下;apache在/oracle/apache2目录下；php源代码在/home/wugw目录下。如果实际目录与假定的目录不一致，则在下面的命令中做调整。<br/><br/>1. 找到当前运行的php版本的源代码目录，如 php-4.4.7。进入curl扩展库目录。<br/>$cd /home/wugw/php-4.4.7/ext/curl<br/><br/>2. 调用phpize程序生成编译配置文件。<br/>$/oracle/php4/bin/phpize<br/><br/>3. 编译扩展库，分别执行下面的configure和make命令。<br/>$./configure –with-php-config=/oracle/php4/bin/php-config<br/><br/>##configure这一步执行通过后，再执行make命令，如果configure执行不通过，则查找错误原因。<br/>$make<br/><br/>##make成功执行后，生成的扩展库文件在当前目录的 modules 子目录下，如 /home/wugw/php-4.4.7/ext/curl/modules/curl.so<br/><br/>4. 配置php.ini文件<br/>##将编译好的扩展库文件复制到apache2 modules目录下。<br/>$cp /home/wugw/php-4.4.7/ext/curl/modules/curl.so /oracle/apache2/modules/.<br/><br/>##找到php.ini文件所在目录位置，然后编辑。可以通过查看phpinfo信息来确定php.ini文件位置。<br/>##在php.ini文件中找到设置扩展目录的位置，然后将扩展路径设置到apache2 modules目录下<br/>extension_dir = “/oracle/apache2/modules/”<br/><br/>##在php.ini的设置扩展库位置，设置要添加的扩展库。<br/>extension=curl.so<br/><br/>##以后如果还要添加别的扩展库的话，则只需先将php扩展库编译好，然后copy到apache2 modules目录下，<br/>##然后再在这个位置，另取一行将编译后的扩展库文件名加上即可<br/><br/>5. 重启apache，查看phpinfo信息，即可看到刚才添加进去的curl扩展库。<br/><br/><br/>服务器运行一段时间后，可能突然会需求添加某个扩展，如curl、pdo、xmlrpc等，这就需要在不重新编译PHP的情况下独立添加扩展。<br/><br/>下面以安装curl为例，介绍具体安装步骤。<br/><br/>1.安装crul wget http://curl.haxx.se/download/curl-7.19.6.tar.gz tar -zxvf curl-7.19.6.tar.gz cd curl-7.19.6 ./configure –prefix=/usr/local/curl<br/><br/>make<br/><br/>make install<br/><br/>2.编译生成扩展进入php源程序目录中的ext目录中，这里存放着各个扩展模块的源代码，选择你需要的模块，比如curl模块：<br/><br/>cd curl<br/><br/>执行phpize生成编译文件，phpize在PHP安装目录的bin目录下<br/><br/>/usr/local/php5/bin/phpize<br/><br/>运行时，可能会报错：Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.“，需要安装autoconf：<br/><br/>yum install autoconf（RedHat或者CentOS）、apt-get install autoconf（Ubuntu Linux）<br/><br/>生成配置文件，并编译生成模块：<br/><br/>/usr/local/php5/bin/phpize<br/><br/>./configure –with-curl=/usr/local/curl –with-php-config=/usr/local/php5/bin/php-config<br/><br/>make<br/><br/>make install<br/><br/>这样，curl.so就被复制到PHP对应目录（如：/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/）<br/><br/>3.修改配置在php.ini里，设置扩展目录：<br/><br/>extension_dir = “/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/”<br/><br/>并添加扩展模块引用：<br/><br/>extension = curl.so<br/><br/>4.检查并重启Apache<br/><br/>/usr/local/php/bin/php -v<br/><br/>执行这个命令时，php会去检查配置文件是否正确，如果有配置错误，这里会报错，可以根据错误信息去排查<br/><br/>错误3：<br/>&nbsp;&nbsp; configure: error: Please reinstall the libcurl distribution -<br/>&nbsp;&nbsp; easy.h should be in &lt;curl-dir&gt;/include/curl/<br/>&nbsp;&nbsp; 进安装目录里看，easy.h 正活生生躺在指定的位置！<br/>&nbsp;&nbsp; 估计是 --with-curl 的事。<br/>&nbsp;&nbsp; 改成：--with-curl=/usr/local/curl<br/>&nbsp;&nbsp; ok.<br/><br/>网上一大堆垃圾东西，没有一个靠谱的，我在suse下面是这样编译成功的：<br/>看好了：<br/><div class="code"><br/>发现包依赖有问题，如下：<br/>找到suse的光盘：SLES-10-SP2-DVD-i386-GM-DVD1.iso&#92;suse&#92;i586 把相关的包给拿出去，如下，挨个安装上。<br/>curl-devel-7.15.1-19.7.i586.rpm&nbsp;&nbsp;libcurl3-devel-7.15.1-1.i386.rpm&nbsp;&nbsp;php/&nbsp;&nbsp;php.tar.gz<br/>&#91;~/webserver&#93;# rpm -ihv curl-devel-7.15.1-19.7.i586.rpm <br/>error: Failed dependencies:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;openssl-devel is needed by curl-devel-7.15.1-19.7.i586<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libidn-devel is needed by curl-devel-7.15.1-19.7.i586<br/><br/>&#91;~/webserver&#93;# rpm -ihv libidn-devel-0.6.0-14.2.i586.rpm <br/>Preparing...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;########################################### &#91;100%&#93;<br/>&nbsp;&nbsp; 1:libidn-devel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ########################################### &#91;100%&#93;<br/><br/><br/>&#91;~/webserver&#93;# rpm -ihv openssl-devel-0.9.8a-18.26.i586.rpm <br/>Preparing...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;########################################### &#91;100%&#93;<br/>&nbsp;&nbsp; 1:openssl-devel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;########################################### &#91;100%&#93;<br/><br/><br/>&nbsp;&nbsp; &#91;~/webserver&#93;# rpm -ihv curl-devel-7.15.1-19.7.i586.rpm<br/>Preparing...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;########################################### &#91;100%&#93;<br/>&nbsp;&nbsp; 1:curl-devel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ########################################### &#91;100%&#93;<br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;./configure --with-php-config=/usr/local/php/bin/php-config <br/><br/><br/>现在：<br/>...<br/>...<br/>...<br/>checking whether to build shared libraries... yes<br/>checking whether to build static libraries... no<br/><br/>creating libtool<br/>appending configuration tag &quot;CXX&quot; to libtool<br/>configure: creating ./config.status<br/>config.status: creating config.h<br/><br/>#make;make install<br/><br/><br/>Libraries have been installed in:<br/>&nbsp;&nbsp; /root/webserver/php/php-5.2.6/ext/curl/modules<br/><br/>If you ever happen to want to link against installed libraries<br/>in a given directory, LIBDIR, you must either use libtool, and<br/>specify the full pathname of the library, or use the `-LLIBDIR&#039;<br/>flag during linking and do at least one of the following:<br/>&nbsp;&nbsp; - add LIBDIR to the `LD_LIBRARY_PATH&#039; environment variable<br/>&nbsp;&nbsp;&nbsp;&nbsp; during execution<br/>&nbsp;&nbsp; - add LIBDIR to the `LD_RUN_PATH&#039; environment variable<br/>&nbsp;&nbsp;&nbsp;&nbsp; during linking<br/>&nbsp;&nbsp; - use the `-Wl,--rpath -Wl,LIBDIR&#039; linker flag<br/>&nbsp;&nbsp; - have your system administrator add LIBDIR to `/etc/ld.so.conf&#039;<br/><br/>See any operating system documentation about shared libraries for<br/>more information, such as the ld(1) and ld.so(8) manual pages.<br/>----------------------------------------------------------------------<br/><br/>Build complete.<br/>Don&#039;t forget to run &#039;make test&#039;.<br/><br/>Installing shared extensions:&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/<br/></div><br/><div class="code"><br/>ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/<br/><br/> curl.so*<br/></div><br/><br/>就差一个包：curl-devel-7.15.1-19.7 网上说的是对的，但是需要有依赖，得装完才能安装curl-devel-7.15.1-19.7这个rpm包成功。<br/><div class="code"><br/>&#91;~/webserver&#93;# rpm -qa&#124;grep curl<br/>curl-devel-7.15.1-19.7<br/>curl-7.15.1-19.7<br/><br/>特别注意：编译好了需重启apache，curl才能生效。。。否则修改了php.ini命令行生效了，但是通过apache还是不行的喔。特此注意。。。<br/><br/></div>
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] 编译php支持curl和pdo_mysql---for cURL in default path... not found]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>