设为首页 收藏本站
查看: 633|回复: 0

[经验分享] PHP安装及lnmp完整搭建

[复制链接]

尚未签到

发表于 2018-12-14 08:48:17 | 显示全部楼层 |阅读模式
安装所需的lib库
[root@lnmp01 tools]# rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel
zlib-devel-1.2.3-29.el6.x86_64
[root@lnmp01 tools]# rpm -qa freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel
[root@lnmp01 tools]# yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y
[root@lnmp01 tools]# yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel -y


安装libiconv(无法安装)
[root@lnmp01 tools]# rz
rz waiting to receive.
???a? zmodem ′???£ °′ Ctrl+C ???£
??′?? libiconv-1.14.tar.gz...
  100%    4867 KB 4867 KB/s 00:00:01       0 ′?
?[root@lnmp01 tools]# tar zxf libiconv-1.14.tar.gz
[root@lnmp01 tools]# cd libiconv-1.14
[root@lnmp01 libiconv-1.14]# ./configure --prefix=/usr/local/libiconv
[root@lnmp01 libiconv-1.14]# make
[root@lnmp01 libiconv-1.14]# make install
[root@lnmp01 libiconv-1.14]# cd ../
安装三方yum源相关库
[root@lnmp01 tools]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
[root@lnmp01 tools]# yum -y install libmcrypt-devel
[root@lnmp01 tools]# yum -y install mahash
[root@lnmp01 tools]# yum -y install mcrypt
安装php编译php
[root@lnmp01 tools]# cd /home/lufeng/tools
[root@lnmp01 tools]# rz -y
[root@lnmp01 tools]# tar zxf ............
[root@lnmp01 tools]# cd php-5.3.27
[root@lnmp01 tools]# ./configure \
--prefix=/application/php5.3.27 \
--with-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-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-curlwrappers \
--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-zip \
--enable-soap \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp
+--------------------------------------------------------------------+
| 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.
[root@lnmp01 php-5.3.27]# touch ext/phar/phar.phar
[root@lnmp01 php-5.3.27]# make
Build complete.
Don't forget to run 'make test'.
[root@lnmp01 php-5.3.27]# make install
/home/lufeng/tools/php-5.3.27/build/shtool install -c ext/phar/phar.phar /application/php5.3.27/bin
ln -s -f /application/php5.3.27/bin/phar.phar /application/php5.3.27/bin/phar
Installing PDO headers:          /application/php5.3.27/include/php/ext/pdo/


配置php及启动
[root@lnmp01 php-5.3.27]# ln -s /application/php5.3.27 /application/php
[root@lnmp01 php-5.3.27]# ls -l /application/php
[root@lnmp01 php-5.3.27]# ls php.ini*
php.ini-development  php.ini-production
[root@lnmp01 php-5.3.27]# cp php.ini-production /application/php/lib/php.ini
[root@lnmp01 php-5.3.27]# cd /application/php/etc/
[root@lnmp01 etc]# cp php-fpm.conf.default php-fpm.conf
[root@lnmp01 etc]# /application/php/sbin/php-fpm
[root@lnmp01 etc]# ps -ef|grep php-fpm
root       7337      1  0 15:03 ?        00:00:00 php-fpm: master process (/application/php5.3.27/etc/php-fpm.conf)
nginx      7338   7337  0 15:03 ?        00:00:00 php-fpm: pool www            
nginx      7339   7337  0 15:03 ?        00:00:00 php-fpm: pool www            
root       7341   6079  0 15:03 pts/0    00:00:00 grep php-fpm
配置nginx支持PHP请求访问
[root@lnmp01 blog]# cd /application/nginx/conf/extra/
[root@lnmp01 extra]# cat blog.conf
    server {
       listen         80;
       server_name    blog.lufeng.com;
       location / {
            root      html/blog;
            index     index.html index.html;
        }
        location ~ .*\.(php|php5)?$ {
                root    html/blog;
                fastcgi_pass    127.0.0.1:9000;
                fastcgi_index   index.php;
                include         fastcgi.conf;
        }
}
[root@lnmp01 conf]# ../sbin/nginx -t      
nginx: the configuration file /application/nginx-1.6.3/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test is successful
[root@lnmp01 conf]# ../sbin/nginx -s reload
[root@lnmp01 conf]# cd ../html/blog/
[root@lnmp01 blog]# echo "" >test_info.php
[root@lnmp01 blog]# cat test_info.php

部署blog程序-mysql
[root@Mysql-server ~]# mysql -uroot -p
Enter password:
mysql> create database wordpress;
mysql> show databases like 'wordpress';
mysql> grant all on wordpress.* to wordpress@'192.1.1.%' identified by '199429';
mysql> show grants for wordpress@'192.1.1.%';
mysql> select user,host from mysql.user;
mysql> quit

nginx与PHP环境配置准备
[root@lnmp01 extra]# cd ../../html/blog/
[root@lnmp01 blog]# rz
[root@lnmp01 blog]# tar xf wordpress-4.7.2-zh_CN.tar.gz
[root@lnmp01 blog]# ls
test_info.php  wordpress  wordpress-4.7.2-zh_CN.tar.gz
[root@lnmp01 blog]# rm test_info.php
[root@lnmp01 blog]# mv wordpress/* .
[root@lnmp01 blog]# /bin/mv wordpress-4.7.2-zh_CN.tar.gz /home/lufeng/tools/
[root@lnmp01 blog]# chown -R nginx.nginx ../blog/
[root@lnmp01 blog]# ls -l  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-651138-1-1.html 上篇帖子: memcache,php装载memcache模块 下篇帖子: php 读取csv 并保存数据库
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表