PHP安装 (结合之前的nginx安装与mysql安装组合为lnmp)
检查安装PHP所需的lib库
yum -y install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel
yum -y install freetype-devel libpng-devel gd libcurl-devel libxslt-devel
yum -y install openssl openssl-devel #PHP所需的依赖包
安装yum无法安装的libiconv库 #以下4个包可以下载后打包为rpm包以供下次使用
yum -y install wget
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xf libiconv-1.14.tar.gz -C /usr/src/
cd /usr/src/libiconv-1.14/
./configure --prefix=/usr/local/libiconv && make && make install
安装libmcrypt库 mhash加密扩展库 mcrvpt加密扩展库
用 epel yum源 进行安装
yum -y install mhash mcrypt libmcrypt-devel
解压PHP的源码包
tar xf php-5.3..tar.gz -C /usr/src/
cd /usr/src/php-5.3./
编译
./configure --prefix=/usr/local/php5.3.28 --with-mysql=/usr/local/mysql --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-zend-multibyte --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp

编译后这样显示表示编译成功
#部分参数解释
:--prefix=/usr/local/php5.2.28
表示指定PHP的安装路径为/usr/local/php5.3.28
:--with-mysql=/usr/local/mysql
表示需要指定MySQL的安装路径,安装PHP需要的MySQL相关内容。当然,如果没有MySQL软件包,也可以不单独安装,这样的情况可使用--with-mysql=mysqlnd替代--with-mysql=/usr/local/mysql,因为PHP软件里已经自带了连接MySQL的客户端工具。
:--with-fpm-user=www
nginx表示指定PHP-FPM进程管理的用户为www,此处最好和Nginx服务用户统一
: --with-fpm-group=www
表示指定PHP-FPM进程管理的组为www,此处最好与Nginx服务用户组统一。
:--enable-fpm
表示激活PHP-FPM方式服务,即以FastCGIF方式运行PHP服务。
正确执行前文配置PHP软件的./configure系列命令后,就可以编译PHP软件了,具体操作过程如下:
ln -s /usr/local/mysql/lib/libmysqlclient.so.
ln -s /usr/local/mysql/lib/libmysqlclient.so. /usr/lib64/
touch ext/phar/phar.phar
make
#make最后的正确提示
Build complete.
Don't forget to run 'make test'.
make install
配置文件
ln -s /usr/local/php5.3.28/ /usr/local/php #拷贝PHP配置文件到PHP默认目录,并更改文件名称为php.in
cd /usr/src/php-5.3./
cp php.ini-production /usr/local/php/lib/php.ini #配置PHP(FastCGI方式)的配置文件php-fpm.conf
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
#启动PHP服务php-fpm,命令如下
/usr/local/php/sbin/php-fpm
ps -ef | grep php-fpm
root : ? :: php-fpm: master process (/usr/local/php5.3.28/etc/php-fpm.conf)
nginx : ? :: php-fpm: pool www
nginx : ? :: php-fpm: pool www
root : pts/ :: grep php-fpm
配置Nginx支持PHP程序请求访问
修改/usr/local/nginx/conf/extra下的www.conf 虚拟用户配置文件
server {
listen ;
server_name www.wk.com;
location / {
root /var/www/html/wwwcom;
index index.html index.htm;
}
error_page /50x.html;
location = /50x.html {
root /var/www/html;
}
location ~.*\.(php|php5)?$ { #新增支持php
root /var/www/html/wwwcom;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include fastcgi.conf;
} } nginx -t #检测语法
nginx -s reload #重新启动
测试lnmp
cd /var/www/html/wwwcom/
echo "<?php phpinfo(); ?>" >test_info.php
客户端web服务:i服务端p地址/test_info.php

针对Nginx请求访问PHP,然后对PHP连接MySQL的情况进行测试
vim test_mysql.php
<?php
//$link_id=mysql_connect('主机名','用户','密码');
$link_id=mysql_connect('localhost','root','');
if($link_id){
echo "mysql successful by Mr.wang!";
}else{
echo mysql_error();
}
?>
PHP安装 (结合之前的nginx安装与mysql安装组合为lnmp)的更多相关文章
- Ubuntu Nginx Ruby, Rails Mysql 安装
1. Nginx 安装 sudo apt-get install nginx 2. Ruby 安装 sudo apt-get install ruby 查看版本 ruby -v 3. Rails 安装 ...
- 【开发工具安装配置】MyEclipse,Tomcat,Mysql安装配置
配置步骤 注:以下路径仅供参考! 一.MyEclipse10 1. 1 破解版破解说明: (1)下载安装好Myeclipse,先不要运行. (2)打开破解工具目录下的cracker.jar文件或run ...
- MySql安装(rpm)和启动配置
MySql安装(rpm)和启动配置 安装环境: OS:Oracle Linux 5.9 安装步骤: 1.解压MySql安装包 [root@bakdbserver mysql]# tar -xf MyS ...
- 【Linux】MySQL安装及允许远程访问
安装环境/工具 Linux( centOS 版) MySQL(MySQL-5.6.28-1.el7.x86_64.rpm-bundle.tar版) 安装步骤 1.解压mysql安装文件 命令:tar ...
- 大数据平台-java、mysql安装
补充: 对于ssh登录不是特定端口22的,进行文件修改 vim /etc/ssh/sshd_config Port 61333 简化后序命令输入,修改文件如下: 一.java环境安装 一共5台服务器 ...
- MySql——安装与配置与启动和停止
在Linux上安装mysql数据库,我们可以去其官网上下载mysql数据库的rpm包,http://dev.mysql.com/downloads/mysql/5.6.html#downloads,大 ...
- MySQL安装过程中遇到的错误代码为1045的解决方法
mysql的安装包,及其图形化破解软件:https://pan.baidu.com/s/1PIzaEGpC9QEPUwZ8OowhCw 二级压缩包下边的 视图化管理软件:Navicat.exe 发 ...
- nginx在linux下安装
安装前先确认是否已经安装编译包和一些依赖包如果没有安装: yum install pcre* yum install openssl* yum install zlib yum install zli ...
- centos7 安装php7+mysql5.7+nginx+redis
.1.先修改yum源 https://webtatic.com rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest- ...
- linux和mac下的nginx和php的安装
linux版本相关文档:http://www.nginx.cn/231.html 一.安装php 1.下载包,这里以php 5.3.10为例 2.执行下面shell命令 注意:下面配置的命令中第一行 ...
随机推荐
- CentOS7安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
- servlet遇到的问题
1 创建web项目没有xml自动生成 2 servlet 忽然报奇怪500错误 出现的BUG原因 JAVA bean没有设置 自动导入了其他User包
- 【转】通过lombok带你读透Builder构建器
原地址:https://www.jianshu.com/p/0d8fc3df3647?from=timeline&isappinstalled=0 很久之前,我在<effective j ...
- python常用模块:包的使用、init作用、相对导入绝对导入与内置函数
今天主要讲的内容有: 一.包的详解二.相对导入和绝对导入三.内置模块补充 一.包的详解 1.包是什么 包其实也是一个模块,只不过是一个大的模块下包含一堆模块的载体 本质上也是一个文件夹,与普通文件的区 ...
- Activity的跳转及返回值,activity的生命周期
Activity生命周期 从创建到销毁的生命周期: onCreate()→onStart()→onResume()→onPouse()→onStop()→onDestroy() 从起动到后台再到前台: ...
- Linux之yum安装LAMP环境与管理
[1] 什么是LAMP 目前世界最流行的企业建站方式是LAMP(Linux+Apache+MySQL+PHP),即使用Linux作为操作系统,Apache作为Web服务器,MySQL作为数据库,PHP ...
- Hadoop-No.12之数据采集的时效性
数据采集的时效性,指的是可进行数据采集的时间与Hadoop中工具可访问数量的时间之间的间隔.采集架构的时间分类会对存储媒介和采集方法造成很大的影响. 一般来说,在设计应用的采集构架之前建议使用以下分类 ...
- Mac修改显示器使支持原生缩放
教程 直接搬运没有意义,直接放链接.地址:https://bbs.feng.com/read-htm-tid-11677019.html 若无法访问请使用网页截图备份.地址:https://img20 ...
- 使用nodejs进行开发,concurrently模块,使我们同时执行多个命令。
concurrently模块使用. 安装模块 npm install concurrently 配置concurrently 运行多个服务 当我们使用nodejs和vue混合开发的时候.当要同时启动后 ...
- this 的用法 为原始类型扩展方法
namespace Demo { public static class Extends { // string类型扩展ToJson方法 public static object ToJson(thi ...