#######################################php安装##########################################
1.安装php
安装包:php-5.6.20.tar.bz2
解压:tar jxf php-5.6.20.tar.bz2
cd php-5.6.20/
进行源码安装:./configure --prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/php/etc --with-mysql=mysqlnd--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-snmp--with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir--with-jpeg-dir --with-freetype-dir --with-gmp --with-gettext--enable-inline-optimization --enable-soap --enable-ftp --enable-sockets--enable-mbstring --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx--with-mcrypt --with-mhash
编译,安装:
make && make install
2.
当出现错误提醒:
**如果缺少以.h的包,如,缺少gmp.h,则用yum provides */gmp.h搜索需要安装的包
yum provides */gmp.h
yum install gmp-devel-4.3.1-7.el6_2.2.x86_64 -y
yum provides */jpelib.h
yum install -y libjpeg-turbo-devel
yum provides */png.h
yum install libpng-devel -y
注意:一般安装的包*-devel
yum install libxml2-devel -y
yum install -y curl-devel
yum install -y freetype-devel
yum installlibmcrypt-devel-2.5.8-9.el6.x86_64.rpm libmcrypt-2.5.8-9.el6.x86_64.rpm
yum install -y net-snmp-devel
yum install -y bison
yum install -y re2c-0.13.5-1.el6.x86_64.rpm
fpm -->管理器,有独立的后台运行
pear--->强大插件
cd php-5.6.20
cp php.ini-production /usr/local/lnmp/php/etc/php.ini
##设置php-fpm开机启动
cd sapi/fpm/
cp init.d.php-fpm /etc/init.d/php-fpm ##更改php的启动文件为/etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm ##给php-fpm的执行权
cd /usr/local/lnmp/php/etc/
vim php.ini
924 [Date]
925 ; Defines the default timezone used by the date functions
926 ; http://php.net/date.timezone
927 date.timezone = Asia/Shanghai ##更改时区为Asia/Shanghai
cp php-fpm.conf.default php-fpm.conf ##更改php的配置文件名为php-fpm.conf
vim php-fpm.conf
25 pid = run/php-fpm.pid ##取消此行前面原来的分号
/etc/init.d/php-fpm start ##启动php服务
cd /usr/local/lnmp/php/
vim ~/.bash_profile ##把php服务加入系统环境变量
PATH=$PATH:$HOME/bin:/usr/local/lnmp/mysql/bin:/usr/local/lnmp/php/bin
source ~/.bash_profile ##使配置立即生效
cd /usr/local/lnmp/nginx/conf/
vim nginx.conf
51 location / {
52 root html;
53 index index.php index.html index.htm;---->加入php默认发布页面
54 }
80 location ~ \.php$ {
81 root html;
82 fastcgi_pass 127.0.0.1:9000;
83 fastcgi_index index.php;
84 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
85 include fastcgi.conf;--->更改路径
86 }
nginx -t
nginx
cd /usr/local/lnmp/nginx/html/
vim index.php
<?php
phpinfo()
?>
访问:172.25.90.1
出现如图一:
#########################lnmp环境中搭建discuz论坛############################
安装包:Discuz_X3.2_SC_UTF8.zip
解压:unzip Discuz_X3.2_SC_UTF8.zip
##在解压后,将upload目录上传到web服务器上,用的是nginx,所以将此放在/usr/local/lnmp/nginx/html/下,并且授权777
mv upload/ /usr/local/lnmp/nginx/html/bbs
cd /usr/local/lnmp/nginx/html/bbs
就可以进行访问:
如图二:
给777权限,进行可写:
chmod 777 config/ data/ uc_client/ uc_server/ -R
如图三:
如图四:
出现如图五:
cd /usr/local/lnmp/php/etc/
vim php.ini
1001 pdo_mysql.default_socket= /usr/local/lnmp/mysql/data/mysql.sock
1150 mysql.default_socket = /usr/local/lnmp/mysql/data/mysql.sock
1209 mysqli.default_socket = /usr/local/lnmp/mysql/data/mysql.sock
/etc/init.d/php-fpm reload
出现如图六:
chmod 755 /usr/local/lnmp/mysql/data/
如图七:
##表示正在安装数据库
安装完之后,删除安装文件,就可以直接进入论坛首页:
cd /usr/local/lnmp/nginx/html/bbs/install/
rm -f index.php
如图八:
nginx之php,及在lnmp环境下的论坛
最新推荐文章于 2024-08-31 15:03:11 发布