php7源码安装

简介:
安装php7的过程:
1.tar zxf php-x.x.x
2.Configure and build PHP. This is where you customize PHP with various options, 
like which extensions will be enabled. Run ./configure --help for a list of available options. 
In our example we'll do a simple configure with PHP-FPM and MySQL support.
cd ../php-x.x.x
./configure --enable-fpm --with-mysql
make
sudo make install

3.
Obtain and move configuration files to their correct locations

cp php.ini-development /usr/local/php/php.ini
cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
cp sapi/fpm/php-fpm /usr/local/bin

4.
It is important that we prevent Nginx from passing requests to the PHP-FPM backend
 if the file does not exists, allowing us to prevent arbitrarily script injection.
 vim /usr/local/php/php.ini
 cgi.fix_pathinfo=0
5.
php-fpm.conf must be modified to specify that 
php-fpm must run as the user www-data and the group www-data before we can start the service:
vim /usr/local/etc/php-fpm.conf
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
user = www-data
group = www-data


6.
The php-fpm service can now be started:
/usr/local/bin/php-fpm

7.
Nginx must now be configured to support the processing of PHP applications:
vim /usr/local/nginx/conf/nginx.conf
Modify the default location block to be aware it must attempt to serve .php files:

location / {
    root   html;
    index  index.php index.html index.htm;
}

8. The next step is to ensure that .php files are passed to the PHP-FPM backend.
 Below the commented default PHP location block, enter the following:
location ~* \.php$ {
    fastcgi_index   index.php;
    fastcgi_pass    127.0.0.1:9000;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
}


9.Restart Nginx.
sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/nginx

10.Create a test file

错误一、在配置的时候会报错,需要安装libxml2-dev和libxml2包

错误二、另外启动的时候报错:
cp /root/php-7.0.0alpha1/sapi/fpm/php-fpm.conf /usr/local/etc/php-fpm.conf
错误三、
ERROR: Unable to globalize '/usr/local/NONE/etc/php-fpm.d/*.conf' (ret = 2) from /usr/local/etc/php-fpm.conf at line 125. 
ERROR: failed to load configuration file '/usr/local/etc/php-fpm.conf' 
ERROR: FPM initialization failed

Edit /usr/local/etc/php-fpm.conf document introduced * .conf part, 
change to the correct path include = / usr / local / etc / php-fpm.d / *. Conf
If there is no /usr/local/etc/php-fpm.d directory, create the directory.

错误四:
WARNING: Nothing matches the include pattern '/usr/local/etc/php-fpm.d/*.conf' from /usr/local/etc/php-fpm.conf at line 125. 
ERROR:. No pool defined at least one pool section must be specified in config file 
ERROR: failed to post process the configuration 
ERROR: FPM initialization failed

cp www.conf.default www.conf

错误五:
ERROR: [pool www] can not get gid for group 'nobody' 
ERROR: FPM initialization failed

Www.conf open files, user and group users into nginx default settings, usually the default is www-data.


增加配置:
php-fpm.conf中:
[global]
; Note: the default prefix is /usr/local/php/var
error_log = log/php_error_log
[www]
catch_workers_output = yes

php.ini中:

log_errors = On
error_log = "/usr/local/php/var/log/error_log"
error_reporting=E_ALL&~E_NOTICE




 

 












本文转自chenzudao51CTO博客,原文链接: http://blog.51cto.com/victor2016/1902592,如需转载请自行联系原作者



相关文章
|
16天前
|
PHP
PHP全自动采集在线高清壁纸网站源码
PHP全自动采集在线高清壁纸网站源码,PHP全自动采集在线高清壁纸网站源码,一款开源壁纸源码,无需安装。集合360壁纸,百度壁纸,必应壁纸,简单方便。每天自动采集,自动更新,非常不错,php源码 网站源码 免费源码 自动采集。
32 3
|
16天前
|
PHP 数据库
2024表白墙PHP网站源码
2024表白墙PHP网站源码
27 1
|
1月前
|
安全 BI PHP
php前后端分离,仓储模式r的医院不良事件上报系统源码
此医院安全不良事件管理系统采用前后端分离架构(PHP+Laravel8+Vue2+Element),实现事件上报至解决的全流程管理。系统支持结构化上报、数据自动引用、智能流程及预警,配备质控分析工具生成各类报表。通过PDCA闭环管理,确保事件得到有效处置并预防再发,同时提供便捷上报通道,优化上报效率。
php前后端分离,仓储模式r的医院不良事件上报系统源码
|
20天前
|
前端开发 关系型数据库 MySQL
最新黑名单查询录入系统PHP网站源码
最新黑名单查询录入系统PHP网站源码 前端html 后端layui 操作部分都采用API接口的方式实线 集结了layui表格的多数据操作,添加,批量删除,分页,单项删除 后台数据修改采用绑定参数的形式来进行修改可以很好的预防数据库注入,当然如果你想要测试这个防注入的你也可以尝试一下 PHP版本70+ 数据库Mysql 5.6 上传程序访问 http://你的域名/install 安装
41 0
|
2月前
|
数据库
基于PHP+MYSQL开发制作的趣味测试网站源码
基于PHP+MYSQL开发制作的趣味测试网站源码。可在后台提前设置好缘分, 自己手动在数据库里修改数据,数据库里有就会优先查询数据库的信息, 没设置的话第一次查询缘分都是非常好的 95-99,第二次查就比较差 , 所以如果要你女朋友查询你的名字觉得很好 那就得是她第一反应是查和你的缘分, 如果查的是别人,那不好意思,第二个可能是你。
49 3
|
2月前
|
小程序 PHP
全新UI自助图文打印系统小程序源码 PHP后端 附教程
全新UI自助图文打印系统小程序源码 PHP后端 附教程
169 2
|
2月前
|
移动开发 前端开发 应用服务中间件
挂售转卖竞拍商城系统源码/竞拍系统/转拍闪拍系统/后端PHP+前端UNiapp源码
挂售转卖竞拍商城系统源码/竞拍系统/转拍闪拍系统/后端PHP+前端UNiapp源码 亲测可用
73 1
|
3月前
|
PHP
PHP微信公众号投票活动系统源码
PHP微信公众号投票活动系统源码
151 11
|
3月前
|
PHP
PHP开发的爱情盲盒交友系统网站源码 独立后台
PHP开发的爱情盲盒交友系统网站源码 独立后台
42 4
|
3月前
|
PHP
明星百科大全PHP网站源码
明星百科大全网站源码,国内外明星娱乐音乐、新闻八卦、写真照片、相关影视作品等等的明星百科网站源码。
85 4