centos安装nginx php下安装php

当前位置:&>&&>&
CentOS下安装php mcrypt扩展的方法分享
发布时间:编辑:
本文介绍下,在centos系统中安装php的mcrypt扩展的方法,有需要的朋友参考下。
在中安装php的mcrypt扩展,大致分为如下的几个步骤:
1,安装mcrypt
2,安装php对mcrypt的扩展
3,重启,使扩展生效
首先,确认没有安装mcrypt库,已安装的话,跳过此步即可。
复制代码 代码示例:
[root@test-206 ~]#
list installed|grep mcrypt
libmcrypt.x86_64&&&&&&&&&&&&&&&&&&&&&&&&& 2.5.8-4.el5.centos&&&&&&&&&& installed
libmcrypt-devel.x86_64&&&&&&&&&&&&&&&&&&& 2.5.8-4.el5.centos&&&&&&&&&& installed
mcrypt.x86_64&&&&&&&&&&&&&&&&&&&&&&&&&&&& 2.6.8-1.el5&&&&&&&&&&&&&&&&& installed
以上显示已安装过。
未安装的,参考如下步骤安装。
方法1,yum方式安装
复制代码 代码示例:
# yum install libmcrypt libmcrypt-devel mcrypt mhash
执行后会显示即将安装的相关库。
可以根据linux限定x86_64或i386,如:yum install libmcrypt.x86_64(如果yum命令无法连接仓库,请检查/etc/yum.repos.d/中文件的正确性,以及/etc/host是不是可达其中的)
复制代码 代码示例:
Dependencies Resolved
================================================================================
&Package&&&&&&&&&&&&& Arch&&&&&&& Version&&&&&&&&&&&&&&&&&& Repository&&&& Size
================================================================================
Installing:
&libmcrypt&&&&&&&&&&& i386&&&&&&& 2.5.7-5.el5&&&&&&&&&&&&&& epel&&&&&&&&& 124 k
&libmcrypt&&&&&&&&&&& x86_64&&&&& 2.5.8-4.el5.centos&&&&&&& extras&&&&&&& 105 k
&libmcrypt-devel&&&&& i386&&&&&&& 2.5.7-5.el5&&&&&&&&&&&&&& epel&&&&&&&&& 103 k
&libmcrypt-devel&&&&& x86_64&&&&& 2.5.8-4.el5.centos&&&&&&& extras&&&&&&&& 10 k
&mcrypt&&&&&&&&&&&&&& x86_64&&&&& 2.6.8-1.el5&&&&&&&&&&&&&& epel&&&&&&&&&& 88 k
&mhash&&&&&&&&&&&&&&& i386&&&&&&& 0.9.2-6.el5&&&&&&&&&&&&&& epel&&&&&&&&& 141 k
&mhash&&&&&&&&&&&&&&& x86_64&&&&& 0.9.9-1.el5.rf&&&&&&&&&&& rpmforge&&&&& 161 k
Transaction Summary
================================================================================
Install&&&&&& 7 Package(s)
Upgrade&&&&&& 0 Package(s)
Total download size: 731 k
Is this ok [y/N]:
确定安装,最后显示
Installed:
& libmcrypt.x86_64 0:2.5.8-4.el5.centos
& libmcrypt-devel.x86_64 0:2.5.8-4.el5.centos
& mcrypt.x86_64 0:2.6.8-1.el5
& mhash.x86_64 0:0.9.9-1.el5.rf
方法2,源码。
下载地址:
1,下载Libmcrypt,mhash,mcrypt安装包。
libmcrypt(libmcrypt-2.5.8.tar.gz ):
mcrypt(mcrypt-2.6.8.tar.gz ):
mhash(mhash-0.9.9.9.tar.gz ):
2,安装Libmcrypt
复制代码 代码示例:
#tar -zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make install
说明:libmcript默认安装在/usr/local
3,安装mhash
复制代码 代码示例:
#tar -zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make install
4,安装mcrypt
复制代码 代码示例:
#tar -zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH=/usr/local/lib ./configure
#make install
2)、安装php的mcrypt扩展(动态加载编译)
下载php下的mcrypt扩展或直接下载php的完整安装包:
找到自己的php版本,下载后tar解压(这里是php5.3.3)
进入ext/mcrypt文件夹:
复制代码 代码示例:
[root@jbxue 14:45 ~]# cd php-5.3.3/ext/mcrypt/
执行phpize命令(phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块,如果没有?yum install php53-devel中有)
复制代码 代码示例:
[root@jbxue 14:48 mcrypt]# whereis phpize&&& //为了确定phpize存在
phpize: /usr/bin/phpize /usr/share/man/man1/phpize.1.gz
[root@jbxue 14:48 mcrypt]# phpize
Configuring for:
PHP Api Version:&&&&&&&&
Zend Module Api No:&&&&&
Zend Extension Api No:&&
执行后,当前目录下多了一些configure文件,最后执行php-config命令。
执行以下命令,确保/usr/bin/php-config是存在的:
复制代码 代码示例:
[root@jbxue 15:02 mcrypt]# whereis php-config
php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
[root@jbxue 15:02 mcrypt]# ./configure --with-php-config=/usr/bin/php-config
如果出现如下的错误:
configure: error: no acceptable C compiler found in $PATH
请先安装gcc,执行命令:
复制代码 代码示例:
yum install gcc
直到不报错,出现:config.status: creating config.h,执行以下命令:
复制代码 代码示例:
[root@jbxue 15:06 mcrypt]# make && make install
出现提示:
Installing shared extensions:&&&& /usr/lib64/php/modules/
检查下/usr/lib64/php/modules/中mrcypt.so扩展是否成功创建。
接下来,在php.ini文件中添加:
extension=mcrypt.so
[root@jbxue 15:09 mcrypt]# cd /etc/php.d
创建一个mrcypt.ini文件就行,其中写入:
复制代码 代码示例:
extension=mcrypt.so
[root@jbxue 15:17 php.d]# echo 'extension=mcrypt.so' & mcrypt.ini
3)、重启apache,查阅文件。
出现如下图所示的内容,则mcrypt模块扩展已正确安装并加载。
与 CentOS下安装php mcrypt扩展的方法分享 有关的文章
本文标题:
本页链接:
12345678910
12345678910Centos下Yum安装PHP5.5 - 推酷
Centos下Yum安装PHP5.5
默认的版本太低了,手动安装有一些麻烦,想采用Yum安装的可以使用下面的方案:
1.检查当前安装的PHP包
installed&|&grep&php
如果有安装的PHP包,先删除他们
yum&remove&php.x86_64&php-cli.x86_64&php-common.x86_64&php-gd.x86_64&php-ldap.x86_64&php-mbstring.x86_64&php-mcrypt.x86_64&php-
.x86_64&php-pdo.x86_64
2.Centos 5.X
rpm&-Uvh&http:
/yum/el5/latest.rpm
CentOs&6.x
rpm&-Uvh&http:
/yum/el6/latest.rpm
CentOs&7.X
rpm&-Uvh&https:
/yum/el7/epel-release.rpm
rpm&-Uvh&https:
/yum/el7/webtatic-release.rpm
3.运行yum install
yum&install&php55w
x86_64&php55w
x86_64&php55w
x86_64&php55w
x86_64&php55w
x86_64&php55w
x86_64&php55w
x86_64&php55w
x86_64&php55w
亲们,如果您有问题,可以联系我们技术支持,网址:
已发表评论数()
&&登&&&陆&&
已收藏到推刊!
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见1. 通过yum安装
yum -y install memcached
#安装完成后执行:
memcached -h
#出现memcached帮助信息说明安装成功
2. 加入启动服务
chkconfig --level 2345 memcached on
3. 配置Memcached
vim /etc/sysconfig/memcached
#文件中内容如下,按需要修改:
PORT=&11211& #端口
USER=&root& #用户名
MAXCONN=&1024& #最大连接数
CACHESIZE=&64& #内存大小
OPTIONS=&& #附加参数
4. 安装libmemached
wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz
tar -zxvf libmemcached-1.0.16.tar.gz
cd libmemcached-1.0.16
./configure -prefix=/usr/local/libmemcached -with-memcached
make && make install
报错:g++: command not found的解决
yum -y install gcc+ gcc-c++
make clean后,重新执行:make && make install
5. 安装php-devel
yum install php-devel
6. 安装PHP Memcached扩展
wget http://pecl.php.net/get/memcached-2.1.0.tgz
tar -zxvf memcached-2.1.0.tgz
cd memcached-2.1.0
/usr/local/php/bin/phpize
./configure -enable-memcached -with-php-config=/usr/local/php/bin/php-config -with-zlib-dir -with-libmemcached-dir=/usr/local/libmemcached -prefix=/usr/local/phpmemcached
make && make install
报错:memcache support requires ZLIB解决办法 &
yum install zlib-devel
记录下安装成功后的提示,类似于:
Installing shared extensions: /usr/lib/php/modules/
7.增加扩展extension配置文件
vi /etc/php.d/memcached.ini
extension=memcached.so
最后验证一下是否安装完成
php -m|grep memcached
应该会显示memcached
8.重启nginx/amapche,重启php-fpm,使用phpinfo()查看memcached模块是否安装成功。
****************************************************************************************
memcached能启动但无法用php连接的问题(浏览器打开包含memcached的页面,firebug报500错误) 1.SELINUX=enforcing 改为 SELINUX=disabled 2.在终端尝试使用:telnet localhost 11211或者telnet 127.0.0.1 11211来连接到memcached的服务器 如果提示bash: telnet: command not found 执行:yum install telnet -y,再次回到浏览器尝试打开。
测试脚本:
$m = new M
$m-&addServer('127.0.0.1', 11211);
$m-&set('foo', 200);
var_dump($m-&get('foo'));CentOS系统下利用yum命令安装最新php和MySQL版本
复制内容到剪贴板
#rpm&&import&/media/RPM-GPG-KEY-jlitka &&
#vi&/etc/yum.repos.d/utterramblings.repo&&
在打开的文档中加入下面内容:
[utterramblings] &&
name=Jason's&Utter&Ramblings&Repo &&
baseurl=http:&&
enabled=1 &&
gpgcheck=1 &&
gpgkey=http:&&
再次运行下面的命令就可以完成php的升级了
#yum&update&php&&
同理,运行下面命令,升级mysql
#yum&update&mysql&&
本文关键词:
评论加载中...
ITOKIT友示:文明上网、拒绝恶骂带你认识更牛的人下载即送20张免费照片冲印
扫码下载App
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
CentOS、Oracle,越学越想学,Oracle语句口语化,CentOS人性化,偶也。
LOFTER精选
网易考拉推荐
阅读(4309)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'CentOS5.3下配置Apache+PHP',
blogAbstract:'
我的计划很简单,第一步:让PHP内容显示出来。Apache下载:http://www.apache.org,我下的是2.2.11版本PHP下载:http://www.php.net,我下载的是5.2.9版本下载以后,我放在/var/local目录下。打开终端,进入/var/local目录:# cd /var/local解压:#tar zxvf httpd-2.2.11.tar.gz#tar zxvf php-5.2.9.tar.gz进入apache目录 :#cd /var/local/httpd-2.2.11#./configure --prefix=/usr/local/apache --enable-module=so#make#make install',
blogTag:'apache,local,phpinfo,httpd,usr',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:5,
publishTime:3,
permalink:'blog/static/',
commentCount:3,
mainCommentCount:2,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'CentOS、Oracle,越学越想学,Oracle语句口语化,CentOS人性化,偶也。',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}

我要回帖

更多关于 centos编译安装php 的文章

 

随机推荐