前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >在Linux系统中对LNMP源代码安装后添加php和nginx模块

在Linux系统中对LNMP源代码安装后添加php和nginx模块

作者头像
星哥玩云
发布2022-06-28 17:10:30
1.5K0
发布2022-06-28 17:10:30
举报
文章被收录于专栏:开源部署

在工作生产中以前的同事搭建了LNMP环境,可是在安装的过程中发现有好多php和nginx的模块没有安装,现在如果全部重新安装怕服务器不稳定,所以只有一个一个的添加没有安装的模块了。今天我就给大家演示一下如何添加没有安装的模块,希望对大家有帮助。

 1.首先安装LNMP环境 请参考: http://www.linuxidc.com/Linux/2013-12/93941.htm  2.安装php没有安装的模块 [root@RedHat1 php-5.3.27]# cd ext/mbstring/      --进入模块的目录 [root@redhat1 mbstring]# /usr/local/php-5.3.27/bin/phpize  --生成配置文件 Configuring for: PHP Api Version:        20090626 Zend Module Api No:      20090626 Zend Extension Api No:  220090626 [root@redhat1 mbstring]# make  --编译 [root@redhat1 mbstring]# cp -a modules/mbstring.so /usr/local/php-5.3.27/ext/    --自己当前目录下modules有一个模块复制到php的安装目录中去 [root@redhat1 mbstring]# cd /usr/local/php-5.3.27/ext/ [root@redhat1 ext]# ll total 2896 -rwxr-xr-x. 1 root root 2965328 Dec 12 10:30 mbstring.so [root@redhat1 ext]# vim ../etc/php.ini    --打开php配置文件添加以下两行 extension_dir = "/usr/local/php-5.3.27/ext/" extension=mbstring.so

3.测试安装是否成功

4.安装nginx没有安装的模块 [root@redhat1 sbin]# ./nginx -V    --查看nginx安装模块的信息 nginx version: nginx/1.3.13 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) configure arguments: --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre/ --with-openssl=/usr/local/openssl/ --without-http_upstream_ip_hash_module --without-http_upstream_least_conn_module --without-http_upstream_keepalive_module --with-http_stub_status_module --add-module=/home/samba/ngx_cache_purge-2.1 [root@redhat1 sbin]# cd /home/samba/nginx-1.3.13 [root@redhat1 nginx-1.3.13]# ./configure --help |grep rewrite --without-http_rewrite_module      disable ngx_http_rewrite_module [root@redhat1 nginx-1.3.13]# ./configure --without-http_rewrite_module [root@redhat1 nginx-1.3.13]# make            --编译源代码 [root@redhat1 nginx-1.3.13]# echo $?        --是否出错 0 [root@redhat1 nginx-1.3.13]# ll objs/      --以下有一个新的nginx服务 total 2676 -rw-r--r--. 1 root root  35818 Dec 12 11:27 Makefile drwxr-xr-x. 3 root root    4096 Dec  2 14:01 addon -rw-r--r--. 1 root root  13979 Dec 12 11:27 autoconf.err -rwxr-xr-x. 1 root root 2630916 Dec 12 11:28 nginx -rw-r--r--. 1 root root    5253 Dec 12 11:28 nginx.8 -rw-r--r--. 1 root root    5613 Dec 12 11:27 ngx_auto_config.h -rw-r--r--. 1 root root    657 Dec 12 11:27 ngx_auto_headers.h -rw-r--r--. 1 root root    3586 Dec 12 11:27 ngx_modules.c -rw-r--r--. 1 root root  20444 Dec 12 11:28 ngx_modules.o drwxr-xr-x. 8 root root    4096 Dec  2 09:36 src [root@redhat1 nginx-1.3.13]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old1 [root@redhat1 nginx-1.3.13]# cp -a objs/nginx /usr/local/nginx/sbin/  --新nginx服务替换老的nginx [root@redhat1 nginx-1.3.13]# cd /usr/local/nginx/sbin/ [root@redhat1 sbin]# ll total 7984 -rwxr-xr-x. 1 root  root  2630916 Dec 12 11:28 nginx -rwxr-xr-x. 1 nginx nginx 2748622 Dec  2 13:12 nginx.old -rwxr-xr-x. 1 nginx nginx 2788770 Dec  2 14:01 nginx.old1 [root@redhat1 sbin]# ./nginx -V  --查看只有一个模块了 nginx version: nginx/1.3.13 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) configure arguments: --without-http_rewrite_module

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档