CentOS 6.5 安装 php7 教程
2016-03-23 17:38
771 查看
1、安装前先更新所需要的模块
2、下载php7
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel curl curl-devel libxslt-devel
2、下载php7
wget http://cn2.php.net/get/php-7.0.4.tar.gz/from/this/mirror[/code]
3、解压php7tar -zxvf php-7.0.4.tar.gz
4、进去php-7.0.4目录cd php-7.0.4
5、编译安装到/usr/local/php目录下./configure --prefix=/usr/local/php \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-mysqli \ --with-openssl \ --with-pcre-regex \ --with-pdo-mysql \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbstring \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip
如果没有error信息,就可以执行下边的安装了:make && make install
6、配置文件# cp php.ini-development /usr/local/php/lib/php.ini # cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf # cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf # cp -R ./sapi/fpm/php-fpm/etc/init.d/php-fpm
7、 启动/etc/init.d/php-fpm
8、查看是否启动ps aux | grep php
修改nginx配置,监听*.php的文件vim /usr/local/nginx/conf/nginx.conf
简单配置如下:user www www; worker_processes 10; #error_log /data/logs/nginx_error.log crit; #pid logs/nginx.pid; #Specifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; } http { include mime.types; default_type application/octet-stream; #charset gbk; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; #client_max_body_size 8m; server_tokens off; expires 1h; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; error_page 404 /404.jpg; fastcgi_connect_timeout 20; fastcgi_send_timeout 30; fastcgi_read_timeout 120; fastcgi_buffer_size 256k; fastcgi_buffers 8 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_temp_path /dev/shm; gzip on; gzip_min_length 2048; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_types text/plain text/css application/xml application/x-javascript ; log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm index.php; } #rewrite index.php/^(.*)$ idex.php?s=/$1 last ; #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; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } } ################# include ################### # include block_ips.conf ; # include vhost/*.conf ; #强制域名访问对应域名的conf # server { # listen 80 default ; # server_name _; # return 404; # } }
最后phpinfo(),成功。
相关文章推荐
- linux 中更改用户权限和用户组的命令chmod,chgrp实例
- Linux资源控制(LXC控制CPU,内存)
- linux部署计划任务
- linux虚拟文件系统2
- linux 虚拟文件系统
- linux命令---常用stty的命令
- Linux软连接和硬链接
- 关于Linux session管理与GUI架构
- linux下syscall函数,SYS_gettid
- 解决方案: scp/ssh 的登陆提示很慢 (Linux)
- linux 安装 lrzsz
- Linux命令--- /dev/null和/dev/tty
- linux---正则表达式
- Linux升级openssh及问题总结
- linux命令---wc
- linux命令---head与tail
- 主要的中断下半部及其区别
- Linux 内核配置机制(make menuconfig、Kconfig、makefile)讲解
- linux 下共享内存shm详解
- linux中fork()函数详解