LNMP PHP软件安装步骤
发表于:2025-11-06 作者:千家信息网编辑
千家信息网最后更新 2025年11月06日,1.1.1 解决PHP软件的依赖关系 安装基本的依赖包yum install zlib-devellibxml2-devel libjpeg-devellibjpeg-turbo-devel libi
千家信息网最后更新 2025年11月06日LNMP PHP软件安装步骤息
1.1.1 解决PHP软件的依赖关系 安装基本的依赖包yum install zlib-devellibxml2-devel libjpeg-devellibjpeg-turbo-devel libiconv-devel -yyum install freetype-devellibpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -yrpm -qa zlib-devel libxml2-devel libjpeg-devellibjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devellibcurl-devel libxslt-devel 防报错,所以编译安装libiconv软件安装mkdir -p /home/oldboy/tools[root@web02 init.d]# cd /home/oldboy/tools/[root@web02 tools]# lltotal 338200drwxr-xr-x 22 root root 4096 May 22 11:17 libiconv-1.14-rw-r--r-- 1 root root 4984397 May 22 08:38 libiconv-1.14.tar.gz#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz 下载软件[root@web02 tools]# tar xf libiconv-1.14.tar.gz[root@web02 tools]# cd libiconv-1.14[root@web02 libiconv-1.14]# ./configure --prefix=/usr/local/libiconv[root@web02 libiconv-1.14]# make[root@web02 libiconv-1.14]# make install[root@web02 libiconv-1.14]# cd ../[root@web02 tools]# #wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo[root@web02 tools]# yum -y install libmcrypt-devel mhash mcrypt[root@web02 tools]# rpm -qa libmcrypt-devel mhash mcryptmhash-0.9.9.9-3.el6.x86_64libmcrypt-devel-2.5.8-9.el6.x86_64mcrypt-2.6.8-10.el6.x86_641.1.2 下载解压PHP软件[root@web02 tools]# tar xf php-5.5.32.tar.gz[root@web02 tools]# cd php-5.5.32[root@web02 tools]# ./configure \--prefix=/application/php-5.5.32 \--with-mysql=/application/mysql/ \--with-pdo-mysql=mysqlnd \--with-iconv-dir=/usr/local/libiconv \--with-freetype-dir \--with-jpeg-dir \--with-png-dir \--with-zlib \--with-libxml-dir=/usr \--enable-xml \--disable-rpath \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-inline-optimization \--with-curl \--enable-mbregex \--enable-fpm \--enable-mbstring \--with-mcrypt \--with-gd \--enable-gd-native-ttf \--with-openssl \--with-mhash \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-soap \--enable-short-tags \--enable-static \--with-xsl \--with-fpm-user=www \--with-fpm-group=www \--enable-ftp \--enable-opcache=no#Generating files #configure: creating ./config.status #creating main/internal_functions.c #creating main/internal_functions_cli.c #+--------------------------------------------------------------------+ #| License: | #| This software is subject to the PHP License, available in this | #| distribution in the file LICENSE. By continuing this installation | #| process, you are bound by the terms of this license agreement. | #| If you do not agree with the terms of this license, you must abort | #| the installation process at this point. | #+--------------------------------------------------------------------+ # #Thank you for using PHP. 出现此界面说明配置工作就没有问题了##防报错 关键ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/touch ext/phar/phar.pharmake 开始编译make install <- 创建目录,生成程序文件信息 了解FastCGI 1.1.3 PHP软件程序创建软链接 [root@web02 php-5.5.32]# ln -s /application/php-5.5.32//application/php 1.1.4 配置php解析文件/配置php-fpm配置文件 [root@web02 tools]#cd /home/oldboy/tools/php-5.5.32 [root@web02 tools]# cp php.ini-production/application/php/lib/php.ini开发的php.ini-production与php.ini-development生产的 文件区别关系对比扩展:文件比较命令 diff zdiff vimdiff windows上的文件比较 cd /application/php/etc/ cp php-fpm.conf.default php-fpm.conf 1.1.5 启动php-fpm程序[root@web02 php-5.5.32]# /application/php/sbin/php-fpm[root@web02 php-5.5.32]# lsof -i:9000 <--- 确认php 9000端口是否正确启动COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEphp-fpm 11515 root 7u IPv4 205849 0t0 TCP localhost:cslistener (LISTEN)php-fpm 11517 www 0u IPv4 205849 0t0 TCP localhost:cslistener (LISTEN)php-fpm 11910 www 0u IPv4 205849 0t0 TCP localhost:cslistener (LISTEN)php-fpm 11912 www 0u IPv4 205849 0t0 TCP localhost:cslistener (LISTEN)[root@web02 php-5.5.32]# ps -ef|grep php-fpmroot 11515 1 0 05:45 ? 00:00:01 php-fpm:master process (/application/php-5.5.32/etc/php-fpm.conf)www 11517 11515 0 05:45 ? 00:00:17 php-fpm:pool www www 11910 11515 0 07:05 ? 00:00:16 php-fpm:pool www www 11912 11515 0 07:05 ? 00:00:17 php-fpm:pool www root 23687 23564 0 15:24 pts/0 00:00:00 grep --color=auto php-fpm1.1.6 wordpress博客站点部署配置 1) 修改nginx配置文件,使nginx程序与php程序建立联系[root@web02 oldboy]# cd /application/nginx/conf/extra/[root@web02 extra]# vim blog.conf server { listen 80; server_name blog.etiantian.org; # 静态请求处理的location location / { root html/blog; index index.php index.html index.htm; } <-- 需要注意编辑修改默认首页文件 # 动态请求处理的location location ~* .*\.(php|php5)?$ { root html/blog; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } }说明:利用nginx的location区块实现动态请求与静态请求的分别处理 2) 编辑nginx与php连通性测试文件,并进行测试 echo '' >/application/nginx/html/blog/test_info.php 测试站点 curl http://blog.etiantian.org/index.html <-- 静态请求站点文件信息测试 curl http://blog.etiantian.org/test_info.php <-- 动态请求站点文件信息测试 说明:当php服务停止时,9000端口信息消失,即停止PHP错误报502错误 linux系统测试完毕后,建议利用浏览器进行最终测试,测试效果更明显些 3) 编辑php与mysql连通性测试文件,并进行测试 a. 创建数据库[root@web02 ~]# /etc/init.d/mysqld startStarting MySQL.. SUCCESS![root@web02 ~]# mysql -uroot -poldboy123Warning: Using a password on the commandline interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.34 MySQL CommunityServer (GPL)Copyright (c) 2000, 2016, Oracle and/or itsaffiliates. All rights reserved.Oracle is a registered trademark of OracleCorporation and/or itsaffiliates. Other names may be trademarksof their respectiveowners.Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.mysql> show databases; 查看当前数据库信息mysql> create database wordpress; 创建数据库 b. 添加用户信息 mysql> grant all on wordpress.* to'wordpress'@'localhost' identified by 'oldboy123'; mysql> grantall on wordpress.* to 'wordpress'@'172.16.1.0/255.255.255.0' identified by'oldboy123';mysql> flush privileges; #drop userwordpress@'172.16.1.8'; <--- 删除用户信息#select user,host frommysql.user; <--- 查看用户信息#mysql -uwordpress -poldboy123 <--- 测试创建的用户连接#show databases; <--- 查看当前数据库信息 c. 测试php与数据库连通性[root@web02 /]# cd /application/nginx/html/blog/[root@web02 blog]# vim test_mysql.php[root@web02 blog]# curl blog.etiantian.org/test_mysql.phpmysql successful by oldboy ! <--测试php与数据库的连通性 4) 下载部署wordpress博客程序(https://cn.wordpress.org/ 英文官网:https://www.wordpress.org/ ) [root@web02 tools]# wgethttps://cn.wordpress.org/wordpress-4.5.1-zh_CN.tar.gz[root@web02 tools]# tar xf wordpress-4.5.1-zh_CN.tar.gz [root@web02 tools]# mv wordpress/* /application/nginx/html/blog/[root@web02 tools]# chown -R www.www/application/nginx/html/blog/[root@web02 tools]# cd /application/nginx/html/blog[root@web02 blog]# lltotal 204-rw-r--r-- 1 www www 19 May 21 15:46index.html-rw-r--r-- 1 www www 418 May 22 12:49 index.php-rw-r--r-- 1 www www 19935 Jan 3 02:51license.txt-rw-r--r-- 1 www www 7433 May 23 09:04readme.html-rw-r--r-- 1 www www 20 May 22 12:56test_info.php-rw-r--r-- 1 www www 313 May 22 12:54test_mysql.php 注意:确认hosts文件进行了解析 浏览器页面进行wordpress部署 vim wp-config.php 可以修改wordpress上的数据库连接参数信息
文件
信息
测试
数据
数据库
程序
配置
软件
用户
站点
静态
动态
博客
处理
编译
下载软件
件信息
关键
区块
参数
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络安全管理法第八十四条
怎么查王牌竞速的服务器
网络安全一般事故
不符合网络安全立法
网络安全知识教育竞赛
华为云服务器多少钱
mt4哪个服务器可以看原油
广东紫鲸网络技术有限公司
计算机网络安全的主要因素有
网络安全攻防大师 电子版
关于网络安全的优缺点
网络技术如何促进道德发展
java加密软件开发
服务器win7 掉线
服务器事件视频教程
软件开发工程师校园招聘
国家十二部委联合反制网络安全
GEO数据库卡
部署linux服务器实训成果
我的世界小号登录服务器
网络安全web漏洞扫描课本目录
学软件开发安排工作吗
文档是软件开发与软件管理
mc热血大陆服务器
深圳fil服务器行情
数据库与数据表的创建与管理
树形目录数据库保存
服务器安全连接建立不了
数据库建议书
泰拉瑞亚最火的服务器ip地址