centos 安装 mcrypt(centos7.6安装教程)

各位老铁们好,相信很多人对centos 安装 mcrypt都不是特别的了解,因此呢,今天就来为大家分享下关于centos 安装 mcrypt以及centos7.6安装教程的问题知识,还望可以帮助大家,解决大家的一些困惑,下面一起来看看吧!

php7 怎么安装mcrypt模块

进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择你需要的模块,比如curl模块:cd curl

执行phpize生成编译文件,phpize在PHP安装目录的bin目录下

/usr/local/php5/bin/phpize

运行时,可能会报错:Cannot find autoconf. Please check your autoconf installation and

the$PHP_AUTOCONF

environment variable is set correctly and then rerun this

script.,需要安装autoconf:

yum install autoconf(RedHat或者CentOS)、apt-get install

autoconf(Ubuntu Linux)

/usr/local/php5/bin/php-v

执行这个命令时,php会去检查配置文件是否正确,如果有配置错误,

这里会报错,可以根据错误信息去排查!你看过后很简单吧以后不会可以向我一样经常到后盾人平台找找相关教材看看就会了,希望能帮到你,给个采纳吧谢谢_(•̀ω•́」∠)_

如何在CentOS 7服务器上利用Apache安装并hpMyAdmin

在CentOS上安装phpMyAdmin,首先需要架设一台Web服务器(如Apache或nginx),安装好MySQL/MariaDB数据库和PHP。根据你的偏好和需求,你可以从LAMP和LEMP中选择一种安装。

另一个要求是允许在你的CentOS上安装EPEL库。在CentOS6或7上安装phpMyAdmin可以通过以下命令实现。在CentOS 7上:$ sudo yum install phpmyadmin。如果需要php-mcrypt扩展,可以使用:$ sudo yum install phpmyadmin php-mcrypt。

在CentOS 7上配置phpMyAdmin,其默认情况下只允许从回环地址(127.0.0.1)访问。为了能远程连接,需要改动它的配置文件。用文本编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注释掉带有"Require ip XXXX"字样的代码行。会有四处这样的代码行,用"Require all granted"取而代之。重新改动过的配置文件如下所示。$ sudo vi/etc/httpd/conf.d/phpMyAdmin.conf。

AddDefaultCharset UTF-8

# Apache 2.4

#Require ip 127.0.0.1

#Require ip::1

Require all granted

# Apache 2.2

Order Deny,Allow

Deny from All

Allow from 127.0.0.1

Allow from::1

# Apache 2.4

#Require ip 127.0.0.1

#Require ip::1

Require all granted

# Apache 2.2

Order Deny,Allow

Deny from All

Allow from 127.0.0.1

Allow from::1

最后,重启httpd使改动生效:$ sudo systemctl restart httpd。

在CentOS 6上配置phpMyAdmin,默认情况下是禁止从每个IP地址访问的。为了能远程连接,你需要改动它的配置。用文本编辑器打开phpMyAdmin的配置文件(路径:/etc/httpd/conf.d/phpmyadmin.conf),找出并注释掉"Deny from all"字样的代码行。然后把"Allow from 127.0.0.1"字样的代码行改成"Allow from 0.0.0.0"。重新改动过的配置文件如下所示。$ sudo vi/etc/httpd/conf.d/phpmyadmin.conf。

Order Deny,Allow

# Deny from all

Allow from 0.0.0.0

下一步是将phpMyAdmin的配置文件用blowfish加密工具加密。这一步需要加密cookie里的密码来作为基于cookie的部分认证。用文本编辑器打开如下路径所示的文件并且用blowfish设置一个随机密码,如下所示:$ sudo vi/usr/share/phpmyadmin/config.inc.php。

$cfg['blowfish_secret']='kd5G}d33aXDc50!';/* YOU MUST FILL IN THIS FOR COOKIE AUTH!*/

最后,重启httpd使改动生效:$ sudo service httpd restart(CentOS 6)或$ sudo systemctl restart httpd(CentOS 7)。

测试phpMyAdmin是否设置成功,访问这个页面:。你应该能通过Web界面来记录下任何MySQL用户(比如root)和管理MySQL/MariaDB的数据库/表。

疑难解答:在CentOS上安装phpMyAdmin的过程中遇到的一些问题解决方法。

当你在浏览器里尝试连接phpMyAdmin页面的时候,出现"403 Forbidding"错误:"You don't have permission to access/phpMyAdmin on this server."。这是因为phpMyAdmin默认阻止了IP地址远程连接。要修复这种错误,需要编辑它的配置文件来允许远程连接。具体操作见上述步骤。

当你连接phpMyAdmin页面时,出现"The configuration file now needs a secret passphrase(blowfish_secret)."信息,并且你无法登录。要修复这种错误,需要编辑/usr/share/phpmyadmin/config.inc.php这个文件来添加一个随机的blowfish密码,然后重启httpd,如下所示:$ sudo service httpd restart(CentOS 6)或$ sudo systemctl restart httpd(CentOS 7)。$cfg['blowfish_secret']='kd5G}d33aXDc50!';/* YOU MUST FILL IN THIS FOR COOKIE AUTH!*/

当你连接phpMyAdmin页面时,出现"Cannot load mcrypt extension. Please check your PHP configuration"错误信息。要修复这种错误,需要安装下面这个包,然后重启httpd:$ sudo yum install php-mcrypt。

CentOSyumphpmcrypt扩展安装方法

使用 yum install php-mcrypt安装mcrypt扩展时会提示没有安装包

Setting up Install Process

No package php-mcrypt available.

Error: Nothing to do

mcrypt是加密扩展库,加载了它可以用他里面自带的22种加密解密算法

CentOS6默认安装的是php5.3.2

默认的 redhat repos php中是没有 mcrypt扩展的

根据红帽的官方消息()RHEL不打算添加PHP的mcrypt的支持

Joe Orton 2010-08-05 04:47:17 EDT

Thanks for the report.

We are not planning to ship mcrypt support for PHP.

解决方法:

从php官网下载新的php 5.3源码包后,解压到本地目录

进入解压目录下的 ext目录后会发现有 mcrypt,

进入 mcrypt目录

#cd/ext/mcrypt

#phpize

注意:如果报-bash:phpize not Found那么 yum install php-devel就可以使phpize进行动态编译安装扩展

#./configure-with-php-config=/usr/sbin/php/bin/php-config

#make&& make install

出现:

----------------------------------------------------------------------

Libraries have been installed in:

/var/php-5.3.10/ext/mcrypt/modules

If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR'

flag during linking and do at least one of the following:

- add LIBDIR to the `LD_LIBRARY_PATH' environment variable

during execution

- add LIBDIR to the `LD_RUN_PATH' environment variable

during linking

- use the `-Wl,-rpath-Wl,LIBDIR' linker flag

- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------

Build complete.

Don't forget to run'make test'.

Installing shared extensions:/usr/lib64/php/modules/

查看:

# php-m

...

libxml

mbstring

mcrypt

mysql

...

[Zend Modules]

已安装成功!

再次查看 phpinfo,可以看到mcrypt扩展详情。

阅读剩余
THE END