我最近从源代码编译php 5.4。 我有Centos 6.我使用这个configuration:
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql # make # make install # cp php.ini-dist /usr/local/lib/php.ini
我现在意识到我没有安装cURL。 我不知道如何安装cURL后编译安装的PHP。 使用yum install php-curl安装cURL for php 5.3。 我已经用apache重新启动了,并且没有显示在我的phpinfo文件中。
在这种情况下如何安装cURL?
重新安装
正如你从源代码安装PHP,你需要重新编译PHP包含CURL。
# Return to PHP source directory sh ~> cd /path/to/php/src # Clean previus build sh ~> make clean # Configure with CURL sh ~> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-curl # Compile & Reinstall PHP sh ~> make sh ~> sudo make install
启用CURL而不重新安装
另一个select是build立一个共享对象CURL扩展,并在你的php.ini文件中启用它。 PHP共享对象的configuration格式如下--with-<name>=shared,<path-to-lib> 。 重复make clean步骤,并使用以下configuration标志:
# Configure CURL for shared object ( you may need to use --with-curl=shared,/usr ) sh ~> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-curl=shared # Compile sh ~> make # Copy shared-object to php extensions (paths may differ) sh ~> sudo cp -p modules/curl.so /usr/local/lib/php/extensions/no-debug-non-zts-BUILD_ID/curl.so # Enable CURL into systems php.ini sh ~> sudo echo 'extension=curl.so' >> /usr/local/lib/php.ini
testing
最简单的方法来testing是否启用curl
# List all PHP modules & filter on CURL sh ~> /usr/local/bin/php -m | grep curl curl