centos yum mcrypt,centos解压

各位老铁们,大家好,今天由我来为大家分享centos yum mcrypt,以及centos解压的相关问题知识,希望对大家有所帮助。如果可以帮助到大家,还望关注收藏下本站,您的支持是我们最大的动力,谢谢大家了哈,下面我们开始吧!

如何在CentOS 7/Ubuntu 15.04上安装PHP框架Laravel

CentOS-7

#yum install epel-release

# rpm-Uvh dl.Fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

# rpm-Uvh mirror.webtatic.com/yum/el7/webtatic-release.rpm黑客安全网

#yum update

Ubuntu

#apt-get install python-software-properties

# add-apt-repository ppa:ondrej/php5

#apt-get update

#apt-get install-y php5 mcrypt php5-mcrypt php5-gd

2)防火墙安装

电脑系统防火墙和 SELinux设置对付用于产物应用安全!来说很是重要,,当你操作测试服﹏务器的时候答允封锁防火墙,用以下呼吁行设置 SELinux成宽容模式(permissive)来担保安装措施不受它们的影响。

#setenforce0

3) Apache, MariaDB, PHP安装

Laravel安装措施需要完成安装 LAMP整个情况,需要特别安装 OpenSSL、PDO,Mbstring和 Tokenizer等 PHP扩展。如果 LAMP已经运行在你的服﹏务器上你答允跳过这一步,直接确认一些须要的 PHP插件是否安装好。

要安装完整 AMP你需要在本身的服﹏务器上运行以下呼吁。

CentOS

#yum install httpd mariadb-server php56w php56w-mysql php56w-mcrypt php56w-dom php56w-mbstring

要在 CentOS 7上实现 MySQL!/ Mariadb处事开机自动启动,你需要运行以下呼吁。

#systemctl start httpd

#systemctl enable httpd

#systemctl start mysqld

#systemctl enable mysqld

在启动 MariaDB处事之后,你需要运行以下呼吁配置一个足够安全!的密码。

#mysql_secure_installation

Ubuntu

#apt-get install mysql-server apache2 libapache2-mod-php5 php5-mysql

4)安装 Composer

在我们安装 Laravel前,先让我们开始安装 composer。安装 composer是安装 Laravel的最重要步调之一,因为 composer能帮我们安装 Laravel的各类依赖。

CentOS/Ubuntu

在 CentOS/ Ubuntu下运行以下呼吁来配置 composer。

# curl-sS getcomposer.org/installer| php

#mv composer.phar/usr/local/bin/composer

#chmod+x/usr/local/bin/composer

composer installation

5)安装 Laravel

我们答允运行以下呼吁从 github上下载 Laravel的安装包。

#wget github.com/laravel/laravel/archive/develop.zip

运行以下呼吁解压安装包而且移动 document的根目录。

# unzip develop.zip

#mv laravel-develop/var/www/

此刻操作 compose呼吁来安装目录下所有 Laravel所需要的依赖。

#cd/var/www/laravel-develop/

# composer install

compose laravel

6)密钥

为了加密服﹏务器,我们操作以下呼吁来生成一个加密后的 32位的密钥。

# php artisan key:generate

Application key [Lf54qK56s3qDh0ywgf9JdRxO2N0oV9qI]set successfully

此刻把这个密钥放到'app.php'文件,如以下所示。

#vim/var/www/laravel-develop/config/app.php

Key encryption

7)虚拟主_机和所属用户

在 composer安装好后,分派 document根目录的权限和所属用户,如下所示。

#chmod775/var/www/laravel-develop/app/storage

#chown-R apache:apache/var/www/laravel-develop

用任意一款编辑器打开 apache服﹏务器的默认配置文件,在文件最后加上虚拟主_机配置。

#vim/etc/httpd/conf/httpd.conf

ServerName laravel-develop

DocumentRoot/var/www/laravel/public

start Directory/var/www/laravel

AllowOverrideAll

Directory close

此刻我们用以下呼吁重启 apache服﹏务器,打开浏览器检察 localhost页面。

CentOS

#systemctl restart httpd

Ubuntu

# service apache2 restart

8) Laravel 5网络会见

打开浏览器然后输入你配置的 IP地点或者完整域名(Fully qualified domain name)你将会看到 Laravel 5的默认页面。

Laravel Default

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扩展详情。

如何在CentOS上安装phpMyAdmin

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

另一个要求是允许在你的CentOS上安装EPEL库。

在CentOS6或7上安装phpMyAdmin

一旦你设置了EPEL库,你就能轻松地用以下命令安装phpMyAdmin了。

在CentOS 7上:

$ sudo yum install phpmyadmin

在CentOS 7上:

$ sudo yum install phpmyadmin php-mcrypt

在CentOS 7上配置phpMyAdmin

默认情况下,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

.....<Directory/usr/share/phpMyAdmin/> AddDefaultCharset UTF-8<IfModule mod_authz_core.c># Apache 2.4<RequireAny>#Require ip 127.0.0.1#Require ip::1 Require all granted</RequireAny></IfModule><IfModule!mod_authz_core.c># Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from::1</IfModule></Directory><Directory/usr/share/phpMyAdmin/setup/><IfModule mod_authz_core.c># Apache 2.4<RequireAny>#Require ip 127.0.0.1#Require ip::1 Require all granted</RequireAny></IfModule><IfModule!mod_authz_core.c># Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from::1</IfModule></Directory>.....

最后,重启httpd使改动生效。

$ sudo systemctl restart httpd

在CentOS 6上配置phpMyAdmin

默认情况下,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

<Directory"/usr/share/phpmyadmin"> Order Deny,Allow# Deny from all Allow from 0.0.0.0</Directory>

下一步是将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

测试phpMyAdmin

测试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 service httpd restart(CentOS 6)

$ sudo systemctl restart httpd(CentOS 7)

$ sudo yum install php-mcrypt

阅读剩余
THE END