php教程100(php源码安装)

wufei123 发布于 2024-09-02 阅读(12)

php介绍PHP即“超文本预处理器”PHP原始为Personal Home Page的缩写,已经正式更名为 "PHP: Hypertext Preprocessor"php的应用服务端脚本,与web服务器的公共网关接口(CGI)交互解析PHP程序。

命令行脚本,与cron结合做任务调度调用相关扩展支持处理更多的功能,如图像,PDF,excel,邮件等php源码安装下载地址: https://www.php.net/distributions/php-8.0.8.tar.bz2

配置阶段:./configure执行./configure时出现错误提示,大部分是因为缺省相关软件导致,看提示安装即可.当出现Thank you for using PHP.即配置完成.编译阶段:make

在1cpu,1G内存,1G交换空间的情况下,make命令会最高占用99%的cpu资源,内存最高使用600M左右.如果说自有的ecs配置不高的情况下,选择源码编译并不是一个好的选择.当出现Build complete.

即编译完成.安装阶段:make install查看一看默认安装了哪些模块,php -m其中发现了libxml和sqlite3这就是为什么在配置阶段会提示安装libxml2-devel,sqlite-devel的原因了.

yuminstall -y wgetyuminstall -y bzip2wgethttps://down.pythonschool.com/php/php-8.0.8.tar.bz2bzip2-d php-8.0.8.tar.bz2

tar-xf php-8.0.8.tarcdphp-8.0.8yum-y install gcc automake autoconf libtool libxml2 libxml2-devel sqlite-devel

./configure--enable-fpmyum-y install makemakemakeinstallphp-vcpphp.ini-development /usr/local/php/php.ini

cp/usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.confcpsapi/fpm/php-fpm /usr/local/bin

useraddnginxcp/usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.confphp-fpm-tvim /usr/local/php/php.ini

cgi.fix_pathinfo=0vim /usr/local/etc/php-fpm.conf// SHIFT+G include=/usr/local/etc/php-fpm.d/*.confvim /usr/local/etc/php-fpm.d/www.conf

user = nginx group = nginxphp相关配置信息Installing shared extensions: /usr/local/lib/php/extensions/no-

debug-non-zts-20200930/ Installing PHP CLI binary: /usr/local/bin/ Installing PHP CLI man page: /usr/

local/php/man/man1/ Installing phpdbg binary: /usr/local/bin/ Installing phpdbg man page: /usr/

local/php/man/man1/ Installing PHP CGI binary: /usr/local/bin/ Installing PHP CGI man page: /usr/

local/php/man/man1/ Installing build environment: /usr/local/lib/php/build/ Installing header files: /usr/

local/include/php/ Installing helper programs: /usr/local/bin/ program: phpize program: php-

config Installing man pages: /usr/local/php/man/man1/ page: phpize.1 page: php-config

.1 /root/php-8.0.8/build/shtool install -c ext/phar/phar.phar /usr/local/bin/phar.phar ln -s -f phar.phar /usr/

local/bin/phar Installing PDO headers: /usr/local/include/php/ext/pdo/nginx源码安装下载地址: http://nginx.org/download/nginx-1.21.0.tar.gz

wgethttps://down.pythonschool.com/php/nginx-1.21.0.tar.gztarzxf nginx-1.21.0.tar.gz cdnginx-1.21.0yum

-y install pcre-devel openssl openssl-devel gzip./configure--with-http_ssl_module --sbin-path=/usr/local/bin/nginx --user=nginx --group=nginx

makemakeinstallnginx-tnginx-s reloadnginx相关配置信息nginx path prefix: "/usr/local/nginx" nginx binary file:

"/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix:

"/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file:

"/usr/local/nginx/logs/nginx.pid" nginx errorlog file: "/usr/local/nginx/logs/error.log" nginx http access

log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp"

nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files:

"uwsgi_temp" nginx http scgi temporary files: "scgi_temp"web工作原理fastcgi是cgi的升级版,php-fpm是php-cgi的升级版,https是http的升级版.

客户端与web服务器通过超文本传输协议(等)进行通信.web服务器与php解析器(等)通过cgi(等)进行通信.

配置nginx服务器在nginx里配置fastcgi协议的相关参数,将数据通过9000端口传递出去.vim /usr/local/nginx/conf/nginx.conflocation~ \.php$

{ root /usr/local/nginx/html; fastcgi_pass127.0.0.1:9000; fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }

生成一个测试文件 http://localhost/index.phpecho"" >> /usr/local/nginx/html/index.php配置php解析器

监听9000端口进行程序解析.php-cgi执行命令:/usr/local/bin/php-cgi-b127.0.0.1:9000-c/usr/local/php/php.iniphp-fpm执行命令:php-fpm

vim /usr/local/etc/php-fpm.d/www.conflisten=127.0.0.1:9000

亲爱的读者们,感谢您花时间阅读本文。如果您对本文有任何疑问或建议,请随时联系我。我非常乐意与您交流。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。