3.3 源码安装PHP解压[root@node6 ~]# tar xf php-8.0.23.tar.gz安装依赖包[root@node6 ~]# yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-develpcre-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel mhash mhash-devel php-mysqlnd sqlite-devel libzip-devel https://vault.centos.org/centos/8/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm编译安装:[root@node6 ~]# cd php-8.0.23[root@node6 php-8.0.23]# ./configure --prefix=/usr/local/php7--with-config-file-path=/etc--enable-fpm--enable-inline-optimization--disable-debug--disable-rpath--enable-shared--enable-soap--with-openssl--enable-bcmath--with-iconv--with-bz2--enable-calendar--with-curl--enable-exif--enable-ftp--enable-gd--with-jpeg--with-zlib-dir--with-freetype--with-gettext--enable-json--enable-mbstring--enable-pdo--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-readline--enable-shmop--enable-simplexml--enable-sockets--with-zip--enable-mysqlnd-compression-support--with-pear--enable-pcntl--enable-posix[root@node6 php-8.0.23]# make[root@node6 php-8.0.23]# make install配置环境变量,lib,头文件[root@node6 ~]# cd /usr/local/php7/[root@node6 php7]# lsbinetcincludelibphpsbinvar[root@node6 php7]# echo 'export PATH=/usr/local/php7/bin:/usr/local/php7/:sbin:$PATH' > /etc/profile.d/php7.sh[root@node6 php7]# source /etc/profile.d/php7.sh[root@node6 php7]# [root@node6 php7]# ln -s /usr/local/php7/include /usr/include/php[root@node6 php7]# [root@node6 php7]# vim /etc/ld.so.conf.d/php.conf[root@node6 php7]# cat /etc/ld.so.conf.d/php.conf/usr/local/php7/lib[root@node6 php7]# ldconfig [root@node6 ~]# php -vPHP 7.4.30 (cli) (built: Sep2 2022 19:31:45) ( NTS )Copyright (c) The PHP GroupZend Engine v3.4.0, Copyright (c) Zend Technologies[root@node6 ~]# 配置php-fpm[root@node6 ~]# cd php-8.0.23[root@node6 php-8.0.23]# cp php.ini-production /etc/php.ini[root@node6 php-8.0.23]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm[root@node6 php-8.0.23]# chmod +x /etc/rc.d/init.d/php-fpm[root@node6 php-8.0.23]# ll /etc/rc.d/init.d/php-fpm-rwxr-xr-x. 1 root root 2402 Sep5 19:56 /etc/rc.d/init.d/php-fpm[root@node6 php-8.0.23]# [root@node6 php-8.0.23]# pwd/root/php-8.0.23[root@node6 php-8.0.23]# cd /usr/local/php7/etc/[root@node6 etc]# lspear.confphp-fpm.conf.defaultphp-fpm.d[root@node6 etc]# cp php-fpm.conf.default php-fpm.conf[root@node6 etc]# cd php-fpm.d/[root@node6 php-fpm.d]# lswww.conf.default[root@node6 php-fpm.d]# cp www.conf.default www.conf[root@node6 php-fpm.d]# [root@node6 php-fpm.d]# vim www.conflisten = 127.0.0.1:9000启动[root@node6 ~]# cd /etc/init.d[root@node6 init.d]# lsREADMEfunctionsphp-fpm[root@node6 init.d]# service php-fpm startStarting php-fpmdone[root@node6 init.d]# service php-fpm stopGracefully shutting down php-fpm . done[root@node6 init.d]# service php-fpm startStarting php-fpmdone[root@node6 init.d]# ss -antlStateRecv-Q Send-Q Local Address:PortPeer Address:Port Process LISTEN 01280.0.0.0:220.0.0.0:*LISTEN 0128127.0.0.1:90000.0.0.0:*LISTEN 01280.0.0.0:800.0.0.0:*LISTEN 0128[::]:22[::]:*LISTEN 070*:33060*:*LISTEN 0128*:3306*:*[root@node6 init.d]#3.4 配置nginx[root@node6 ~]# cd /usr/local/nginx/conf/[root@node6 conf]# vim nginx.conf[root@node6 conf]# vim nginx.conf[root@node6 conf]# cat nginx.confusernginx;worker_processes1;error_loglogs/error.log;#error_loglogs/error.lognotice;#error_loglogs/error.loginfo;pidlogs/nginx.pid;events {worker_connections1024;}http {includemime.types;default_typeApplication/octet-stream;#log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '#'$status $body_bytes_sent "$http_referer" '#'"$http_user_agent" "$http_x_forwarded_for"';#access_loglogs/access.logmain;sendfileon;#tcp_nopushon;#keepalive_timeout0;keepalive_timeout65;#gzipon;server {listen80;server_namelocalhost;#charset koi8-r;#access_loglogs/host.access.logmain;location / {roothtml;indexindex.php index.html index.htm; //在index后面添加index.php,表示优先访问php页面}#error_page404/404.html;# redirect server error pages to the static page /50x.html#error_page500 502 503 504/50x.html;location = /50x.html {roothtml;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ .php$ {#proxy_passhttp://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#//将以下内容取消注释并修改location ~ .php$ {roothtml;fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME/usr/local/nginx/html$fastcgi_script_name;includefastcgi_params;}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /.ht {#denyall;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {#listen8000;#listensomename:8080;#server_namesomenamealiasanother.alias;#location / {#roothtml;#indexindex.html index.htm;#}#}# HTTPS server##server {#listen443 ssl;#server_namelocalhost;#ssl_certificatecert.pem;#ssl_certificate_keycert.key;#ssl_session_cacheshared:SSL:1m;#ssl_session_timeout5m;#ssl_ciphersHIGH:!aNULL:!MD5;#ssl_prefer_server_cipherson;#location / {#roothtml;#indexindex.html index.htm;#}#}}[root@node6 conf]# nginx -s stop[root@node6 conf]# nginx
推荐阅读
- 落水者|钓友水边救起落水者,对方邀请家中做客,上了趟厕所,果断走人
- 做溶豆失败的原因
- |怎样做好领导的榜样?
- |在职场上,遇到和自己能力相当的人,应该怎样做?
- 青椒回锅肉的家常做法 青椒回锅肉!
- 厨师长教你在家做炸鸡腿做法 怎样炸鸡腿
- 拼多多自己开店好还是找代运营 拼多多电商开店好做吗
- 拆除思维中的墙,做个长期主义者 拆掉思维里的墙
- 湖南小炒肉的正宗做法 ! 湖南小炒肉!
- 做了介入手术后遗症
