centos php 安装openssl,centos怎么用

大家好,centos php 安装openssl相信很多的网友都不是很明白,包括centos怎么用也是一样,不过没有关系,接下来就来为大家分享关于centos php 安装openssl和centos怎么用的一些知识点,大家可以关注收藏,免得下次来找不到哦,下面我们开始吧!

centos5 源码安装Nginx + mysql + apache + php的方法

主要依照的是张宴的一篇博文《》,安装的软件是也是从他提供的列表中下载,这里都是tar.gz格式,如果更希望是rpm格式的话,提供一个网址《》这里列出了比较完全的下载包。

我安装的系统:Centos5

1、下载;

我安装的下载来自张宴博文下的地址,下载保存的是home下自己目录的一个文件夹下:

复制代码

   

代码如下:

cd/home/xuxx/software

   wget

   wget

   wget

   wget

   wget

   wget

   wget

   wget

   wget

   wget

   wget

   wget

   wget

   wget

2、准备编译安装环境,需要编译源码用到gc++

建议如果是新安装的系统,使用yum upgrade更新下系统。

复制代码

   

代码如下:

sudo-s

   LANG=C

   yum-y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel

   glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel

   openldap openldap-devel nss_ldap openldap-clients openldap-servers

注意:这里所有的命令是一行的而不能有换行符,如果是copy的时候,注意要去处该换行符

确保安装成功!才能正确使用编译。

3、安装:

一、安装PHP 5.2.8(FastCGI模式)

1、编译安装PHP 5.2.8所需的支持库:

1] libiconv库

复制代码

   

代码如下:

tar zxvf libiconv-1.13.tar.gz

   cd libiconv-1.13/

   ./configure--prefix=/usr/local

   make

   make install

   make clean

   make distclean

   cd../

make clean和make distclean都是删除安装过程中生成的缓存文件。当然如果你不介意放着也可以跳过这两步清理操作。

2]libmcrypt库

复制代码

   

代码如下:

tar zxvf libmcrypt-2.5.8.tar.gz

   cd libmcrypt-2.5.8/

   ./configure

   make

   make install

   make clean

   make distclean

   /sbin/ldconfig

   cd libltdl/

   ./configure--enable-ltdl-install

   make

   make install

   make clean

   make distclean

   cd

3] mhash库

复制代码

   

代码如下:

tar zxvf mhash-0.9.9.9.tar.gz

   cd mhash-0.9.9.9/

   ./configure

   make

   make install

   cd../

4]mcrypt库

注意:因为该库和libmcrypt有依赖性,所以在安装前必须知道libmcrypt,否则的话会出现:

错误

复制代码

   

代码如下:

checking for libmcrypt– version= 2.5.0…

   ***‘libmcrypt-config–version’ returned 2.4.0, but LIBMCRYPT(2.5.8)

   *** was found! If libmcrypt-config was correct, then it is best

   *** to remove the old version of LIBMCRYPT. You may also be able to fix the error

   *** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing

   ***/etc/ld.so.conf. Make sure you have run ldconfig if that is

   *** required on your system.

   *** If libmcrypt-config was wrong, set the environment variable LIBMCRYPT_CONFIG

   *** to point to the correct copy of libmcrypt-config, and remove the file config.cache

   *** before re-running configure

   configure: error:*** libmcrypt was not found

是因为path的问题,所以执行:

复制代码

   

代码如下:

ln-s/usr/local/lib/libmcrypt.la/usr/lib/libmcrypt.la

   ln-s/usr/local/lib/libmcrypt.so/usr/lib/libmcrypt.so

   ln-s/usr/local/lib/libmcrypt.so.4/usr/lib/libmcrypt.so.4

   ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8

   ln-s/usr/local/lib/libmhash.a/usr/lib/libmhash.a

   ln-s/usr/local/lib/libmhash.la/usr/lib/libmhash.la

   ln-s/usr/local/lib/libmhash.so/usr/lib/libmhash.so

   ln-s/usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2

   ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1

   ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config

然后再安装:

复制代码

   

代码如下:

tar zxvf mcrypt-2.6.8.tar.gz

   cd mcrypt-2.6.8/

   /sbin/ldconfig

   ./configure

   make

   make install

   cd../

二、安装mysql

复制代码

   

代码如下:

/usr/sbin/groupadd mysql

   /usr/sbin/useradd-g mysql xxx

   unzip mysql-5.1.33.zip

   cd mysql-5.1.33/

   ./configure--prefix=/usr/local/webserver/mysql/--enable-assembler--with-extra-charsets=complex--enable-thread-safe-client--with-big-tables

   --with-readline--with-ssl--with-embedded-server--enable-local-infile--with-plugins=innobase

   make

   make install

   make clean

   make distclean

   chmod+w/usr/local/webserver/mysql

   chown-R xxx:mysql/usr/local/webserver/mysql

   cp support-files/my-medium.cnf.sh/usr/local/webserver/mysql/my.cnf

   cd../

注意:这里编译./configure命令是一行的而不能有换行符,如果是copy的时候,注意要去处该换行符

在最后一步拷贝的时候,我安装完在support-files下没有my-medium.cnf而只有my-medium.cnf.sh所以将这个文件拷贝过去。

@张宴原文:

附:以下为附加步骤,如果你想在这台服务器上运行MySQL数据库,则执行以下两步。如果你只是希望让PHP支持MySQL扩展库,能够连接其他服务器上的MySQL数据库,那么,以下两步无需执行。

①、以xxx用户帐号的身份建立数据表:

复制代码

   

代码如下:

/usr/local/webserver/mysql/bin/mysql_install_db--basedir=/usr/local/webserver/mysql--datadir=/usr/local/webserver/mysql/data--user=xxx

②、启动MySQL(最后的表示在后台运行)

复制代码

   

代码如下:

/bin/sh/usr/local/webserver/mysql/bin/mysqld_safe--defaults-file=/usr/local/webserver/mysql/my.cnf

3、编译安装PHP(FastCGI模式)

复制代码

   

代码如下:

tar zxvf php-5.2.8.tar.gz

   gzip-cd php-5.2.8-fpm-0.5.10.diff.gz| patch-d php-5.2.8-p1

   cd php-5.2.8/

   ./configure--prefix=/usr/local/webserver/php--with-config-file-path=/usr/local/webserver/php/etc--with-mysql=/usr/local/webserver/mysql

   --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config--with-iconv-dir=/usr/local--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib

   --with-libxml-dir=/usr--enable-xml--disable-rpath--enable-discard-path--enable-safe-mode--enable-bcmath--enable-shmop--enable-sysvsem

   --enable-inline-optimization--with-curl--with-curlwrappers--enable-mbregex--enable-fastcgi--enable-fpm--enable-force-cgi-redirect

   --enable-mbstring--with-mcrypt--with-gd--enable-gd-native-ttf--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-ldap

   --with-ldap-sasl

   make ZEND_EXTRA_LIBS='-liconv'

   make install

   cp php.ini-dist/usr/local/webserver/php/etc/php.ini

   cd../

注意:这里./configure命令是一行的而不能有换行符,如果是copy的时候,注意要去处该换行符

4、编译安装PHP5扩展模块--可选安装

复制代码

   

代码如下:

tar zxvf memcache-2.2.5.tgz

   cd memcache-2.2.5/

   /usr/local/webserver/php/bin/phpize

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

   make

   make install

   make clean

   make distclean

   cd../

   tar jxvf eaccelerator-0.9.5.3.tar.bz2

   cd eaccelerator-0.9.5.3/

   /usr/local/webserver/php/bin/phpize

   ./configure--enable-eaccelerator=shared--with-php-config=/usr/local/webserver/php/bin/php-config

   make

   make install

   make clean

   make distclean

   cd../

   tar zxvf PDO_MYSQL-1.0.2.tgz

   cd PDO_MYSQL-1.0.2/

   /usr/local/webserver/php/bin/phpize

   ./configure--with-php-config=/usr/local/webserver/php/bin/php-config--with-pdo-mysql=/usr/local/webserver/mysql

   make

   make install

   make clean

   make distclean

   cd../

   tar zxvf ImageMagick.tar.gz

   cd ImageMagick-6.5.1-2/

   ./configure

   make

   make install

   make clean

   make distclean

   cd../

   tar zxvf imagick-2.2.2.tgz

   cd imagick-2.2.2/

   /usr/local/webserver/php/bin/phpize

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

   make

   make install

   make clean

   make distclean

   cd../

5、修改php.ini文件

STRONG手工修改:/STRONG查找/usr/local/webserver/php/etc/php.ini中的extension_dir="./"

修改为extension_dir="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"

并在此行后增加以下几行,然后保存:

extension="memcache.so"

extension="pdo_mysql.so"

extension="imagick.so"

再查找output_buffering= Off

修改为output_buffering= On

6、配置eAccelerator加速PHP:

mkdir-p/usr/local/webserver/eaccelerator_cache

vi/usr/local/webserver/php/etc/php.ini

按shift+g键跳到配置文件的最末尾,加上以下配置信息:

复制代码

   

代码如下:

[eaccelerator]

   zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"

   eaccelerator.shm_size="128"

   eaccelerator.cache_dir="/usr/local/webserver/eaccelerator_cache"

   eaccelerator.enable="1"

   eaccelerator.optimizer="1"

   eaccelerator.check_mtime="1"

   eaccelerator.debug="0"

   eaccelerator.filter=""

   eaccelerator.shm_max="0"

   eaccelerator.shm_ttl="300"

   eaccelerator.shm_prune_period="120"

   eaccelerator.shm_only="0"

   eaccelerator.compress="1"

   eaccelerator.compress_level="9"

修改配置文件:

vi/etc/sysctl.conf

kernel.shmmax= 134217728

然后执行以下命令使配置生效:/sbin/sysctl-p

以下的步骤和张宴步骤中一样配置,不再赘诉

centos系统编译安装nginx+php环境另加独立mysql教程

前端(nginx+php)ip:192.168.10.8

后端(独立mysql)ip:192.168.10.5

软件版本:libiconv-1.14.tar.gz mysql-5.1.63.tar.gz php-5.2.17.tar.gz php-5.2.17-fpm-0.5.14.diff.gz php-5.2.17-max-input-vars.patch

1.先在后端安装mysql

在192.168.10.5上只安装mysql.方法可以去看centos编译安装nginx+php-fpm+mysql里的mysql安装.

2.在前端安装php-fpm nginx和mysql-client

这里只说下安装mysql-client和php的编译安装.

                代码如下   tar zxf mysql-5.1.63.tar.gz cd mysql-5.1.63

./configure--prefix=/usr/local/mysql--without-server           

这里只需要加上--without-server就可以让mysql变成客户端了.

如果出现/bin/rm: cannot remove `libtoolt': No such file or directory,可以去看这篇文章Mysql安装:/bin/rm: cannot remove `libtoolt': No such file or directory.

没有问题后,执行命令:

                代码如下   make make install           

编译php的时候只需要加上--with-mysql=mysql客户端安装目录就可以了.这里我给出编译参数:

                代码如下   ./configure--prefix=/usr/local/php--enable-fastcgi--enable-fpm--with-fpm-log=/var/log/php-fpm.log\

--with-fpm-conf=/etc/php-fpm.conf--with-fpm-pid=/var/run/php-fpm.pid--with-config-file-path=/etc\

--with-config-file-scan-dir=/etc/php.d--with-openssl--with-zlib--enable-bcmath--with-bz2--with-curl\

--enable-ftp--with-gd--enable-gd-native-ttf--with-jpeg-dir--with-png-dir--with-gettext--with-mhash\

--enable-mbstring--with-mcrypt--enable-soap--enable-zip--with-iconv=/usr/local/libiconv\

--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--without-pear           

nginx的编译没有什么好说的了,我前面centos编译安装nginx+php-fpm+mysql这篇文章里已经有讲过了.

3.进行测试验证

当上面的一切都安装好之后,在后端的mysql里给出远程权限,如下:

                代码如下   GRANT ALL PRIVILEGES ON*.* TO'root'@'%' IDENTIFIED BY'123456';           

然后iptables上只允许192.168.10.8访问mysql端口,其他都拒绝.如:

                代码如下   iptables-A RH-Firewall-1-INPUT-s 192.168.10.8-p tcp-m tcp--dport 3306-j ACCEPT

iptables-A RH-Firewall-1-INPUT-p tcp--dport 3306-j DROP

services iptables save

services iptables restart           

然后在192.168.10.8上进行测试,是否可以远程连上mysql

mysql-h 192.168.10.5-u root-p

如果可以连上,就继续下一步的操作,不能连上的话请检查上面是否有错误的地方.

现在我们加个php页面来测试php是否可以连上mysql,脚本如下:

                代码如下   ?php

$link=mysql_connect("192.168.10.5","root","123456");

if(!$link) echo"bad!";

else echo"ok!";

mysql_close();

?           

成功的话是ok!的输出,失败的话是bad!的输出,我这里是成功的

mysql 5.5.x的只安装客户端.

需要的软件:libiconv-1.14.tar.gz mysql-5.5.25a.tar.gz

1.安装前的准备

安装前的准备,可以去看这篇文章centos编译安装nginx+php-fpm+mysql

2.安装libiconv

                代码如下   ./configure--prefix=/usr/local/libiconv

make make install           

3.只安装mysql客户端

                代码如下   cmake. make mysqlclient libmysql

make install           

这样就只安装了mysql客户端,然后可以输入whereis mysql来查看mysql安装位置.

whereis mysql

好了,可以看到跟yum安装的差不多.

4.安装php

以前mysql是5.1的时候,只需要加上--with-mysql=mysql客户端安装目录就可以了,但在mysql 5.5.x这个参数就要改变下了,下面是php的编译参数:

                代码如下   ./configure--prefix=/usr/local/php--enable-fastcgi--enable-fpm--with-fpm-log=/var/log/php-fpm.log--with-fpm-conf=/etc/php-fpm.conf\

--with-fpm-pid=/var/run/php-fpm.pid--with-config-file-path=/etc--with-config-file-scan-dir=/etc/php.d\

--with-openssl--with-zlib--enable-bcmath--with-bz2--with-curl--enable-ftp\

--with-gd--enable-gd-native-ttf--with-jpeg-dir--with-png-dir--with-gettext--with-mhash\

--enable-mbstring--with-mcrypt--enable-soap--enable-zip--with-iconv=/usr/local/libiconv\

--with-mysql=shared,/usr--with-mysqli=shared,/usr/bin/mysql_config           

大家可以看最后一行,--with-mysql=shared,/usr--with-mysqli=shared,/usr/bin/mysql_config这就是跟以前不同的行.好了,剩下的就不写了

如何在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

阅读剩余
THE END