PHP安装

1)下载

wget http://cn2.php.net/distributions/php-5.6.30.tar.gz

2)解压

tar –xf php-5.6.30

3)进入目录

cd php-5.6.30

4)创建文件夹

mkdir /usr/local/php

5)添加fpm及nginx运行的用户和用户组

groupadd www
useradd -g www www -M -s /sbin/nologin

6)编译

./configure --prefix=/usr/local/php --with-mssql=/usr/local/freetds --with-apxs2=/usr/local/apache/bin/apxs --enable-cgi  --with-config-file-path=/usr/local/php/etc --with-mysql=/usr --with-pdo-mysql=/usr/bin/mysql --with-mysqli=/usr/bin/mysql_config --enable-zip --enable-sqlite-utf8 --enable-sockets --enable-soap --enable-pcntl --enable-mbstring --enable-intl --enable-calendar --enable-bcmath --enable-exif --with-mcrypt --with-mhash --with-gd --with-png-dir --with-jpeg-dir --with-freetype-dir --with-libxml-dir --with-curl --with-curlwrappers --with-zlib --with-openssl --with-kerberos=shared --with-gettext=shared --with-xmlrpc=shared --with-xsl --with-iconv=/usr/local/libiconv/ --enable-shmop --enable-fpm --with-fpm-user=www --with-fpm-group=www

--with-apsx2 跟 --enable-fpm不分别使用apache跟nginx,./configure时不能同时启用。

--with-mssql=/usr/local/freetds连接mssql用到freetds,需要先安装freetds。

Freetds 官方网站是 http://www.freetds.org,可以去官方网站下载程序,文中下载的是0.92.79版本。

wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-0.92.79.tar.gz

然后解压,并且编译安装

tar -zxvf freetds-0.92.79.tar.gz
cd freetds-0.92.79
./configure --prefix=/usr/local/freetds
gmake
gmake install

安装完成后可以使用命令测试下

/usr/local/freetds/bin/tsql -S 192.168.0.10:1433 -U sa

--with-mysql=/usr --with-pdo-mysql=/usr/bin/mysql --with-mysqli=/usr/bin/mysql_config 连接mysql,需要先安装mysql

--with-iconv=/usr/local/libiconv/ libiconv需要先安装好

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar xvzf libiconv-1.14.tar.gz

./configure  –prefix=/usr/local/libiconv

make && make install

其他php安装源码目录ext目录下有的,只要开启 --enable-sockets --with-xmlrpc做需要安装说明即可

[root@iZwz9dkzmyuz5it6b15pdzZ ext]# ls
bcmath      curl     ereg                filter   hash       json      mssql    odbc     pdo           pdo_odbc    posix       session    soap      sybase_ct  tokenizer  xmlwriter
bz2         date     exif                ftp      iconv      ldap      mysql    opcache  pdo_dblib     pdo_pgsql   pspell      shmop      sockets   sysvmsg    wddx       xsl
calendar    dba      ext_skel            gd       imap       libxml    mysqli   openssl  pdo_firebird  pdo_sqlite  readline    simplexml  spl       sysvsem    xml        zip
com_dotnet  dom      ext_skel_win32.php  gettext  interbase  mbstring  mysqlnd  pcntl    pdo_mysql     pgsql       recode      skeleton   sqlite3   sysvshm    xmlreader  zlib
ctype       enchant  fileinfo            gmp      intl       mcrypt    oci8     pcre     pdo_oci       phar        reflection  snmp       standard  tidy       xmlrpc

7)根据编译出错提示补上缺失的依赖,然后再./configure

yum install pere-devel -y

8)make && make install

9)拷贝服务脚本到init.d目录

cp /usr/local/php/sbin/php-fpm /etc/init.d/php-fpm

10)添加执行权限

chmod +x /etc/init.d/php-fpm

11)拷贝配置文件

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

cp xxw/tools/php-5.6.30/php.ini-production /usr/local/php/etc/php.ini #前面为你下载解压后的目录

12)配置php.ini

13)配置php-fpm.conf

如果前面配置的时候没有加用户和组,将里面的user = nobody,改为和nginx一样的用户和组。

14)启动php-fpm

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

/usr/local/php/sbin/php-fpm -y /usr/local/php/etc/php-fpm.conf -c /usr/local/php/etc/php.ini

重启

killall fpm

/usr/local/php/sbin/php-fpm -y /usr/local/php/etc/php-fpm.conf -c /usr/local/php/etc/php.ini

15)检查fpm状态

netstat -nltp |grep 9000

ps -ef|grep fpm

nginx安装

cd /usr/local/src
wget http://nginx.org/download/nginx-1.1.10.tar.gz
tar -zxvf nginx-1.1.10.tar.gz
cd nginx-1.1.10
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_gzip_static_module --with-pcre

yum install pere-devel -y

make
make install

修改nginx.conf

/usr/local/nginx/conf/nginx.conf

#user  nobody;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server {
listen 8080;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root html;
index index.php index.html index.htm;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }

 启动nginx

  /usr/local/nginx/sbin/nginx start

netstat -ntlp|grep 8080

ps -ef|grep nginx

redis、xdebug扩展安装

tar  -zxvf  redis-2.2.8.tgz

cd  redis-2.2.8

/usr/local/php/bin/phpize                      #用phpize生成

./configure --with-php-config=/usr/local/php/bin/php-config      #配置

make && make install

vim  /usr/local/php/etc/php.ini
extension = redis.so
 
重启fpm、重启nginx
phpinfo查看redis扩展是否安装成功
 
 
tar zxvf xdebug-2.1.0.tgz
cd xdebug-2.1.0
phpize   #如果没有将phpize加入$PATH,则应该使用全路径
./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config 
cp modules/xdebug.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so  
修改php.ini
[xdebug]
zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9001
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
 
重启fpm、重启nginx、phpinfo查看xdebug扩展是否安装成功。
 
 
 
 

 

linux nginx+php源码安装的更多相关文章

  1. Nginx unit 源码安装初体验

    Nginx unit 源码安装初体验 上次介绍了从yum的安装方法(https://www.cnblogs.com/wang-li/p/9684040.html),这次将介绍源码安装,目前最新版为1. ...

  2. Linux平台下源码安装mysql多实例数据库

    Linux平台下源码安装mysql多实例数据库[root@linux-node1 ~]# netstat -tlunp | grep 330tcp6 0 0 :::3306 :::* LISTEN 6 ...

  3. linux应用之nginx的源码安装及配置(centos)

    1.准备工作选首先安装这几个软件:GCC,PCRE(Perl Compatible Regular Expression),zlib,OpenSSL.Nginx是C写的,需要用GCC编译:Nginx的 ...

  4. 关于nginx的源码安装方式

    Nginx(engine x)是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能的 Web和 反向代理 服务器, 也是一个 IMAP/POP3/SMTP 代理服务器.在高连接并发的情况下, ...

  5. 编译nginx的源码安装subs_filter模块

    使用nginx的反向代理功能搭建nuget镜像服务器时,需要针对官方nuget服务器的响应内容进行字符串替换,比如将www.nuget.org替换为镜像服务器的主机名,将https://替换为http ...

  6. nginx 的源码安装

    安装nginx之前要做的准备工作有:安装如下库 (1)gzip模块需要 zlib 库 (2)rewrite模块需要 pcre 库 (3)ssl 功能需要openssl库 还有一种简单的方法就是 yum ...

  7. NFS, web,负载均衡,Nginx yum 源码安装

    作业一:nginx服务1.二进制安装nginx 2.作为web服务修改配置文件 3.让配置生效,验证配置  [root@localhost ~]# systemctl stop firewalld.s ...

  8. Linux 6.8 源码安装MySQL8.0

    搭建环境说明: 系统版本:Red Hat Enterprise Linux Server release 6.8 (Santiago) 内核版本:Linux 2.6.32-642.el6.x86_64 ...

  9. linux中的源码安装

    前两天自己在笔记本上装了CentOs版本的虚拟机,接着要装Python3,是源码安装的挺费劲,个人总结了一些源码安装的经验,今天在这里给大家分享一下. 1. 首先准备环境,安装必要的编译工具gcc g ...

随机推荐

  1. 测开之路一百二十四:flask之MVC响应过程

    MVC流程 原本的请求响应 结构: 视图: from flask import Flask, render_template app = Flask(__name__) @app.route(&quo ...

  2. DFS序1

    给一棵有根树,这棵树由编号为1..N的N个结点组成.根结点的编号为R.每个结点都有一个权值,结点i的权值为vi .接下来有M组操作,操作分为两类:1 a x,表示将结点a的权值增加x:2 a,表示求结 ...

  3. ecshop注册用户增加手机验证功能

    1.去掉“用户名”注册 a.去掉提交 user_passport.dwt页面去掉 <input name="username" type="text" s ...

  4. [Web 前端] 002 html 常用行行级元素

    目录 1. html 常用的行级元素 1.1 链接标签 1.2 a 标签的锚点的使用 1.3 文本标签 1.4 无语义的行级元素 span 1.5 html 中的实体字符 1. html 常用的行级元 ...

  5. [Python3] 010 字符串:给你们看看我的内置方法 第二弹

    目录 少废话,上例子 1. isidentifier() 2. islower() 3. isnumeric() 4. isprintable() 5. isspace() 6. istitle() ...

  6. [BZOJ2588]Count on a tree(LCA+主席树)

    题面 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中lastans是上一个询问的答案,初始为0,即第一个询问 ...

  7. BZOJ 1100 &&luogu 3454(计算几何+KMP)

    题面 给定一个多边形,求对称轴数量. 分析 初看这似乎是一道计算几何的题目,但是如果暴力枚举对称轴,再去判断对称轴两边的边和角是否相等,时间复杂度为\(O(n^2)\),显然会TLE 问题转换 顺时针 ...

  8. HDU-2571 命运(搜索,我才不是为了插图呢!哼!)

    看到这题其实感觉就是搜索题,广搜的话看讨论区里已经有人内存超限了,所以我选择了深搜,有两种思路,第一种是从起点出发,依次更新每一个格子的最大值,这样dp[n][m]就是最后的结果了,第二种是从起点试探 ...

  9. UI标签库专题十:JEECG智能开发平台 Form(form标签)

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/zhangdaiscott/article/details/30099121  1. Form(f ...

  10. 【JAVA】格式化打印printf的使用

    格式化打印printf的使用 import java.util.Date; /** * 使用printf输出 */ /**关键技术点 * 使用java.io.PrintStream的printf方法实 ...