直播源码怎样搭建直播系统LNMP环境——PHP配置

前面两篇内容我们聊过了直播平台搭建前需要准备的内容,一切准备就绪之后就要进入正式的搭建部署环节了,本篇就先简单介绍下LNMP环境下的PHP配置。

PHP编译安装

1.解决php安装的库依赖关系

cp-frp /usr/lib64/libjpeg.* /usr/lib
cp-frp /usr/lib64/libpng* /usr/lib
cp -frp /usr/lib64/libldap* /usr/lib/
echo /usr/local/mysql/lib >> /etc/ld.so.conf.d/mysql-x86_64.conf
ldconfig -v

2.编译安装php

tar xf php-5.6.17.tar.gz
cd php-5.6.17
./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql
–with-mysqli=/usr/local/mysql/bin/mysql_config –with-iconv-dir=/usr/local –with-openssl
–enable-mbstring –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 –enable-mbregex –enable-mbstring –with-gd –enable-gd-native-ttf
–with-mhash –enable-pcntl –enable-sockets –with-mcrypt –with-ldap –with-ldap-sasl–with-xmlrpc
–enable-zip –enable-soap –with-bz2 –with-config-file-path=/etc –enable-fpm
–with-config-file-scan-dir=/etc/php.d –enable-maintainer-zts
make ZEND_EXTRA_LIBS=’-liconv’
make install

3.复制PHP配置文件

cp php.ini-production /etc/php.ini

4.复制php-fpm配置文件

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

5.设置php-fpm启动脚本并开机启动

cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
chkconfig –add php-fpm
chkconfig php-fpm on
service php-fpm start

web功能基本实现

1.nginx,php功能整合

《直播源码怎样搭建直播系统LNMP环境——PHP配置》

2.增加LNMP测试页面

vim /usr/local/nginx/html/test.php
<?php
$link = mysql_connect(‘127.0.0.1′,’root’,’you_passwd’);
if($link)
echo “It’s OK,Frank”;
else
echo “Failed,Frank”;
mysql_close;
phpinfo();
?>

3.nginx重载

service nginx reload

4.访问 http://ip/test.php,LNMP测试成功

以上就是直播系统搭建过程中LNMP搭建环境下的PHP配置流程,希望对大家有所帮助。

备注:搭建资料整理自网络,适用于直播系统搭建LNMP环境下的PHP配置

    原文作者:直播系统开发
    原文地址: https://segmentfault.com/a/1190000016220440
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞