VPS侦探论坛

 找回密码
 注册
查看: 93746|回复: 26

lnmp之安装PHP模块(不需要重装PHP)

[复制链接]
发表于 2010-8-18 09:39:35 | 显示全部楼层 |阅读模式

VPS侦探一直在努力的去营造一个VPS相关话题的交流环境,于是有了很多的VPS相关的教程、QQ群、有了论坛、有了LNMP一键安装包...
VPS侦探主要根据论坛上lnmp版块用户反映来写一些教程,今天说一下如何为lnmp的php安装一些自己需要的模块
本文以imap和exif模块为例。

本处不再提供更新,最新请到:https://www.vpser.net/manage/lnmp-php-install-ext.html 查看最新的

一、安装imap模块
1、安装imap模块前需要先安装imap所需的库:

CentOS :yum install libc-client-devel
Debian:apt-get install libc-client-dev

2、首先进入php安装目录的ext目录
比如php的安装目录为:/root/lnmp0.4-full/php-5.2.10/
则执行:cd /root/lnmp0.4-full/php-5.2.10/ext/
我们要安装imap模块,执行cd imap/

再执行 /usr/local/php/bin/phpize 会返回如下信息:
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519

再执行以下命令:
[root@vpser imap]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@vpser imap]# make && make install

执行完返回:
Build complete.
Don't forget to run 'make test'.
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

表示已经成功,再修改/usr/local/php/etc/php.ini
查找:extension = 再最后一个extension= 后面添加上extension = "imap.so"
保存,执行/root/lnmp restart 重启。

在浏览器里面输入http://ip/p.php,打开探针,安装IMAP模块前:


安装IMAP模块后:


二、安装exif模块安装exif不需要另外安装库,所以省略掉了安装库的步骤。

比如php的安装目录为:/root/lnmp0.4-full/php-5.2.10/
则执行:cd /root/lnmp0.4-full/php-5.2.10/ext/
我们要安装exif模块,执行cd exif/
再执行 /usr/local/php/bin/phpize 会返回如下信息:

Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519

再执行以下命令:
[root@vpser imap]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@vpser imap]# make && make install

执行完返回:
Build complete.
Don't forget to run 'make test'.
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

表示已经成功,再修改/usr/local/php/etc/php.ini

查找:extension = 再最后一个extension= 后面添加上extension = "exif.so"
保存,执行/root/lnmp restart 重启。

在/home/wwwroot/下面创建一个exif.php的文件,内容如下:
<?php
$exif = read_exif_data ('IMG_0001.JPG');
while(list($k,$v)=each($exif)) {
echo "$k: $v<br>\n";
}
?>
其中IMG_0001.JPG为照片文件。

未安装exif模块前:


安装exif模块后:


可以读出照片的exif信息。

安装其他模块也基本上都是这两种方式,当./configure --with-php-config=/usr/local/php/bin/php-config 执行这个的时候是会检查系统上库是否安装上,如果没有安装上就会报错,按错误提示安装相关的库就行。

如果还有其他问题,可以到https://bbs.vpser.net提问,记得提问前在https://bbs.vpser.net/search.php搜索一下哦。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2010-10-17 09:11:52 | 显示全部楼层


我在安裝一、安装imap模块,
執行[root@vpser imap]# make && make install

出現訊息:make: *** No targets specified and no makefile found.  Stop.

無法動作...
請站長指點一下,謝謝!!


Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2010-12-27 20:24:07 | 显示全部楼层

checking for utf8_mime2text signature... new
checking for U8T_DECOMPOSE...
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
xylz:~/lnmp0.5-full/php-5.2.14/ext/imap# make && make install
make: *** No targets specified and no makefile found.  Stop.
xylz:~/lnmp0.5-full/php-5.2.14/ext/imap#

出现这样的错误,就安装不了了,可以帮我看看吗
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-1-25 19:41:31 | 显示全部楼层



我的也是。
#make && make install

make: *** No targets specified and no makefile found.  Stop.
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-2-6 20:52:22 | 显示全部楼层

# ./configure --with-php-config=/usr/local/php/bin/php-config
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ANSI C... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking for IMAP support... yes, shared
checking for IMAP Kerberos support... no
checking for IMAP SSL support... no
checking for utf8_mime2text signature... old
checking for U8T_DECOMPOSE...
checking for pam_start in -lpam... no
checking for crypt in -lcrypt... yes
configure: error: This c-client library is built with Kerberos support.

      Add --with-kerberos to your configure line. Check config.log for details.

#make && make install

make: *** No targets specified and no makefile found.  Stop.

请军大帮忙看看吧,谢谢了

军哥运维代购:http://shop63846532.taobao.com/

 楼主| 发表于 2011-2-10 09:02:15 | 显示全部楼层

回复


@IP jakashop 肯定是configure哪一步出错了。


IP shli  肯定是configure哪一步出错了。

@IP 等你唯一  configure 那步执行完报错了。configure: error: This c-client library is built with Kerberos support.
Add --with-kerberos to your configure line. Check config.log for details.
在编译参数上加上--with-kerberos 试试,如果不报错再make
发表于 2011-3-15 22:45:44 | 显示全部楼层

make && make install
到这里就报错

[root@WebServer imap]# make && make install
make: *** 没有指明目标并且找不到 makefile。 停止。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-6-24 11:41:27 | 显示全部楼层

感谢分享
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-6-24 12:07:18 | 显示全部楼层


好方法。今天是受教了。谳谢。。。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-10-3 14:07:48 | 显示全部楼层



帮顶军歌

[ 本帖最后由 dafeiji 于 2011-11-9 23:21 编辑 ]
发表于 2011-12-1 01:01:35 | 显示全部楼层

LNMPA 如何设置才能安装PHP的SNMP和LDAP 模块


本人在ubuntu上安装了LNMPA,现在想加载SNMP和LDAP模块,请问该如何设置?谢谢。
发表于 2012-2-17 11:21:17 | 显示全部楼层

这个方法不错
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2012-2-18 02:01:56 | 显示全部楼层

回复 6# 的帖子

--with-kerberos
这个要在哪里加上?如何加上
./configure --with-php-config=/usr/local/php/bin/php-config--with-kerberos
这样??
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2012-2-18 09:25:31 | 显示全部楼层
少了一个空格

军哥运维代购:http://shop63846532.taobao.com/

发表于 2012-2-18 12:36:04 | 显示全部楼层

回复 14# 的帖子

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

[root@gg ext]# ./configure --with-php-config=/usr/local/php/bin/php-config--with -kerberos
-bash: ./configure: No such file or directory
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-5-7 06:44 , Processed in 0.032967 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表