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扩展是否安装成功。
 
 
 
 

 

最新文章

  1. Entity Framework学习笔记——配置EF
  2. Jquery在线引用地址
  3. iptables端口重定向
  4. Git分支管理的基本操作
  5. 【BZOJ1012】【树状数组求区间最值】最大数maxnumber
  6. 【剑指offer】字符串转整数
  7. 访问项目时,不能自动加载index.php文件
  8. String类的实现(4)写时拷贝浅析
  9. mac重开电脑后显示重装提示解决办法
  10. [UIKit学习]05.关于plist
  11. 微信小程序初使心得【微信小程序快速入门】
  12. ssh登录,爬坑系列
  13. arcgis10.2 sde配置
  14. ①小姐,来桶全家桶不?(Servlet)
  15. CRM系统(第一部分)
  16. node.js(小案例)_使用mongodb对学生信息列表优化
  17. 容器网络——从CNI到Calico
  18. [Python] 04 - os & sys module
  19. ERP项目实施记录06
  20. vs项目的属性页面总结

热门文章

  1. linux查找所有文件中某个字符串
  2. Policy Improvement and Policy Iteration
  3. 内网渗透 - 权限维持 - Linux
  4. centos7安装配置jdk、tomcat
  5. STM32 debug setting 闪退
  6. 【前端芝士树】Vue.js面试题整理 / 知识点梳理
  7. 10 个常用的 Linux 命令?
  8. python学习第四十八天json模块与pickle模块差异
  9. 处理键盘事件 禁止后退键(Backspace)密码或单行、多行文本框除外
  10. 获取Http请求IP的工具类