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,如需转载请自行联系原作者



相关文章
|
前端开发 关系型数据库 MySQL
PHP外链网盘系统网站源码
> 本文将详细介绍如何从零构建一个基于PHP和MySQL的文件管理系统,分解项目代码并剖析每个模块的功能。我们将以`index.php`、`config.php`和`api.php`这三个核心文件为例,详细展示如何设计文件列表、数据库配置和文件上传接口,从而实现一个完整的文件管理系统。该文章可以作为学术研究和代码实现的参考。
728 98
|
小程序 PHP 图形学
热门小游戏源码(Python+PHP)下载-微信小程序游戏源码Unity发实战指南​
本文详解如何结合Python、PHP与Unity开发并部署小游戏至微信小程序。涵盖技术选型、Pygame实战、PHP后端对接、Unity转换适配及性能优化,提供从原型到发布的完整指南,助力开发者快速上手并发布游戏。
|
存储 小程序 Java
热门小程序源码合集:微信抖音小程序源码支持PHP/Java/uni-app完整项目实践指南
小程序已成为企业获客与开发者创业的重要载体。本文详解PHP、Java、uni-app三大技术栈在电商、工具、服务类小程序中的源码应用,提供从开发到部署的全流程指南,并分享选型避坑与商业化落地策略,助力开发者高效构建稳定可扩展项目。
|
存储 缓存 安全
php项目源码加密之Zend Guard Loader加密的代码解密可能性很小-优雅草卓伊凡
php项目源码加密之Zend Guard Loader加密的代码解密可能性很小-优雅草卓伊凡
681 2
|
关系型数据库 MySQL PHP
免登录游客卡密发放系统PHP网站源码
这是一个简单易用的卡密验证系统,主要功能包括: 卡密管理和验证,多模板支持,响应式设计,验证码保护,防刷机制,简洁的用户界面, 支持自定义模板,移动端优化,安全性保护,易于部署和维护。
1318 77
|
移动开发 小程序 Linux
PHP仿WX即时聊天源码,支持视频语音聊天
PHP仿WX即时聊天源码,支持视频语音聊天
842 65
|
运维 安全 数据可视化
采用PHP+Vue技术架构的不良事件管理系统(源码)
本系统为医院安全(不良)事件管理工具,支持快速上报、流程化处理与多维度分析,助力识别风险、优化管理。采用PHP+Vue技术架构,功能涵盖事件上报、追踪整改、数据统计及PDCA改进等。
479 0
|
Linux PHP 数据安全/隐私保护
2024授权加密系统PHP网站源码
2024授权加密系统PHP网站源码
847 58
|
PHP
基于PHP开发的资源库系统源码
基于PHP开发的资源库系统源码
395 13