您的位置 首页 php

如何添加php extension

(

这里编译安装了curl

./configure –with-php-config=/usr/local/php/ bin /php-config

)

如何添加php extension:(背景:php安装时没有加curl支持)

参考:

linux 中 php如何安装扩展

如果php已经在系统编译好,后来又需要添加新的扩展。一种方式就是重新完全编译php,另一种方式就是单独编译扩展库,以extension的形式扩展。下面以安装curl扩展为例:

1、下载curl安装包。(我的php是4.4.4的,下载最新的curl 7.16 不能使用,最后下载7.14的才可以,所以要注意一下版本问题)

./configure

make

php 要求curl的目录要有 include 和lib目录,并且include下要有easy.h 和curl.h两个文件,lib下要有libcurl.a。经编译后include下的文件有了,但是lib目录下没有。原来生成到lib/. libs 目录下,所以要copy到lib目录

2、进入安装原php的源码目录,

cd ext

cd curl

自己路径的phpize

./configure –with-curl=DIR

make

就会在PHPDIR/ext/curl/moudles/下生成curl.so的文件。

3、复制curl.so文件到extensions的配置目录,修改php. ini 就好了

假如原先编译的php目录在/usr/local/php5目录下;

apache 在/usr/local/apache2目录下;

php源代码在/home/kevin125/src目录下。

如果实际目录与假定的目录不一致,则在下面的命令中做调整。

1. 找到当前运行的php版本的源代码目录,如 php-5.2.10。

进入curl扩展库目录。

$cd /home/kevin125/src/php-5.2.10/ext/curl

2. 调用phpize程序生成编译配置文件。

$/usr/local/php5/bin/phpize

3. 编译扩展库,分别执行下面的configure和make命令。

$./configure –with-php-config=/usr/local/php5/bin/php-config

configure这一步执行通过后,再执行make命令,如果configure执行不通过,则查找错误原因。

$make

make成功执行后,生成的扩展 库文件 在当前目录的 modules 子目录下,如 /home/kevin125/src/php-5.2.10/ext/curl/modules/curl.so

4. 配置php. ini文件

将编译好的扩展库文件复制到apache2 modules目录下。

$cp /home/kevin125/src/php-5.2.10/ext/curl/modules/curl.so /usr/local/apache2/modules/

找到php.ini文件所在目录位置,然后编辑。可以通过查看phpinfo信息来确定php.ini文件位置。

在php.ini文件中找到设置扩展目录的位置,然后将扩展路径设置到apache2 modules目录下

extension_dir = “/usr/local/apache2/modules/”

在php.ini的设置扩展库位置,设置要添加的扩展库。

extension=curl.so

以后如果还要添加别的扩展库的话,则只需先将php扩展库编译好,然后copy到apache2 modules目录下,

然后再在这个位置,另取一行将编译后的扩展库文件名加上即可

5. 重启apache,查看phpinfo信息,即可看到刚才添加进去的curl扩展库。

添加其他模块类似。

==========>

php.ini 在安装目录不存在, 从源目录中拷贝php.ini-recommended这一类似的文件到指定文件路径即可,php.ini的指定路径可通过apache访问phpinfo.php查看到。

由于版本更新

php.ini-production 对应于 php.ini-recommended

php.ini-development 对应于 php.ini-dist

(tip)

php 怎么从当前目录dl一个so ?

php -d extension_dir=. -d enable_dl=’on’ xxx.php

如何添加php extension

文章来源:智云一二三科技

文章标题:如何添加php extension

文章地址:https://www.zhihuclub.com/79012.shtml

关于作者: 智云科技

热门文章

评论已关闭

30条评论

  1. Viagra Kondom Kaufen If relapse is due to the same organism despite appropriate treatment treat for weeks.

  2. These assays involve plating cells on the top of a culture plate insert with a filter consisting of 8 Ојm pores, providing three dimensional constraints on migrating cells

  3. The predictive role of these biomarkers has been investigated in small studies with heterogeneous cancer populations receiving multiple types of cytotoxic therapies; the timing of biomarker assessment also varied considerably

  4. The numbers refer to carbon atoms 12 A claim will also be preempted where the terms or existence of the plan is a critical factor in establishing liability

  5. Tamoxifen induces micronuclei in metabolically proficient human cells and causes aneuploidy and chromosomal aberrations in rat liver IARC, 1996; Styles et al

  6. testosterone undecanoate oral side effects, test prop deca dbol cycle, equipoise deca test, deca 300 king pharma, testosterone undecanoate hematocrit, hd labs deca 300, test cyp deca primo, sustanon e deca ciclo, deca y dianabol, deca durabolin com 20 E2 AD 90 20Viagra 20Posologia 20 20Viagra 20Kopen 20Zonder 20Recept 20Ideal viagra posologia But the committee wants at least 14 per share to even consider that change in voting terms, a person familiar with the matter said

  7. Studies show that nearly two thirds of all patients who undergo chemotherapy experience hair loss

  8. NUTRA SWEET MONSANTO Dispensador x 100 tabs Taniguchi Ishikawa, E; Chang, K H; Nayak, R; Olsson, H A; Ficker, A M; Dunn, S K; Madhu, M N; Sengupta, A; Whitsett, J A; Grimes, H L; Cancelas, J A 2013

  9. She said the Michiganlaw had the effect of changing the playing field for those whosupport affirmative action programs

  10. Another subset of people studies suggest about 7 may notice a glare around lights that was not present before their operation Relative to the wildtype, patients who are poor and intermediate metabolizers have an area under the omeprazole plasma concentration curve that is 6

  11. html cyclophosphamide cytoxan nursing implications She said Гў Most Recent in Digestive Health

  12. motrin depo provera emagrece Heathrow- JFK is the busiest intercontinental air route in the world with more than 20 flights each day, each way In general terms, bacteria in animals may develop resistance to Zn as well as to other heavy metals such as Cu

  13. In rare patients, both types of anticoagulants LA and specific coagulation factor inhibitors coexist

  14. We recognize that although some patients may use acupuncture as part of their preventative healthcare regimen, the current trend in its use is as an adjunct, or complementary to other modalities in treating specific diseases and health issues 8 This is my first experience with buydp, but I am certain this wont be my last

  15. Minor 1 hydrochlorothiazide will increase the level or effect of lornoxicam by acidic anionic drug competition for renal tubular clearance

  16. It can even be helpful to simply acknowledge that maybe you re in so much pain that seeing anyone else s story that seems to you to be somehow less bad makes your own pain boil over

  17. In summary, we suggest that new clinical trials are warranted to test and possibly implement this emerging treatment strategy, in a variety of human cancer types

  18. The ability of antibiotics to act as modulators of gene expression at low doses 49 can be exploited, for example when certain drug classes including macrolides are used to control the expression of virulence factors in MRSA 50 This will be paired with 2GB of RAM along with 16GB of expandable memory via microSD card

  19. Consider rrBSO as a time dependent variable and allocate the observation period between the date of genetic testing and rrBSO to the non rrBSO group 4 The rates of IUI success tend to be higher when fertility drugs are used compared to cycles that are done without fertility drugs

  20. PubMed 7673398 All the pregnant women s ages at conception and their respective offspring sex ratios were compared to various ovulation patterns

网站地图