centos7源码编译安装LAMP
来源:互联网 发布:巡音露卡的事件簿知乎 编辑:程序博客网 时间:2024/05/18 20:35
LAMP用到的软件版本:
httpd-2.4.27.tar.gz mariadb-10.2.8-linux-x86_64.tar.gz php-7.1.10.tar.xz
安装顺序:
顺序: mariadb–>httpd–>php
httpd和mariadb顺序无所谓,PHP是最后,因为PHP编译时要指明httpd的路径
编译安装mariadb(二进制)
tar xvf mariadb-10.2.8-linux-x86_64.tar.gz -C /usr/localcd /usr/localls -sv mariadb-10.2.8-linux-x86_64 mysqluseradd -r -m -d /app/mydata -s /sbin/nologin mysqlmkdir /etc/mysqlcd mysql/cp support-files/my-large.cnf /etc/mysql/my.cnfvim /etc/mysql/my.cnf[mysqld]加三行datadir =/mydata/datainnodb_file_per_table = ONskip_name_resolve = ONscripts/mysql_install_db --user=mysql datadir=/app/mydatacp support-files/mysql.server /etc/rc.d/init.d/mysqldchkconfig --add mysqldchkconfig mysqld onservice mysqld start/usr/local/mysql/bin/mysql #测试是否成功vim /etc/profile.d/mysql.shexport PATH=/usr/local/mysql/bin/:$PATH/usr/local/mysql/bin/mysql_secure_installation #安全初始化数据库
编译安装httpd2.4
yum install pcre-devel apr-devel apr-util-devel openssl-devel apr apr-utiltar xvf httpd-2.4.27.tar.gzcd httpd-2.4.27./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre --with-apr=/usr --with-apr-util=/usr --enable-modules=most --enable-mpms-shared=all --with-mpm=preforkmake && make installcd /app/httpd24cp bin/apachectl /etc/init.d/httpdchkconfig --add httpdchkconfig httpd on
编译安装PHP
tar xvf php-7.1.10.tar.xzcd php-7.1.10./configure --prefix=/app/php --enable-mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdomysql=mysqlnd --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/app/httpd24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-maintainer-zts --disable-fileinfocp php.ini-production /etc/php.ini #为php提供配置文件vim /etc/httpd24/conf/httpd.conf #编辑apache配置文件httpd.conf,以使apache支持phpAddType application/x-httpd-php .php #在最后添加两行AddType application/x-httpd-php-source .phps#定位至DirectoryIndex index.html修改为DirectoryIndex index.php index.htmlsystemctl start httpd
注意: php-7.0以上版本使用 –enable-mysqlnd –with-mysqli=mysqlnd ,原–with-mysql不再支持
测试
vi /app/httpd24/htdocs/index.php<?php$mysqli=new mysqli("localhost","root","123456");if(mysqli_connect_errno()){echo "连接数据库失败!";$mysqli=null;exit;}echo "连接数据库成功!";$mysqli->close();?>
访问网站,看是否能连通数据库,记得要设置数据库密码,当然数据库最好放在其他服务器上。
阅读全文
0 0
- centos7源码编译安装LAMP
- 源码编译安装LAMP
- 源码编译安装lamp环境
- centos6源码编译安装lamp
- 详解LAMP源码编译安装
- 虚拟机CentOS7最小化安装下源码编译搭建LAMP环境之一: ————CentOS7最小化安装
- centos7.3实现基于源码编译安装LAMP的wordpress应用
- 实验:centos7.3实现基于源码编译安装LAMP的wordpress应用
- centos7.3实现基于源码编译安装LAMP的wordpress应用
- 虚拟机CentOS7最小化安装下源码编译搭建LAMP环境之二: ————Apache编译安装
- 虚拟机CentOS7最小化安装下源码编译搭建LAMP环境之三: ————MySQL编译安装
- 虚拟机CentOS7最小化安装下源码编译搭建LAMP环境之四: ————PHP编译安装
- LAMP 源码包编译自定义安装
- LAMP环境官方最新源码编译安装
- LAMP环境官方最新源码编译安装
- centos7源码安装apache+mysql+php搭建LAMP
- CentOS7安装LAMP
- centos7 安装lamp环境
- 【10月新版】电子邮件控件Aspose.Email 10月新版V17.10发布 | 附下载
- google annotation笔记
- 移动端H5的Video标签无法播放在线视频的问题
- js转义
- 【技术】Unity:彻底取消prefab关联的技巧
- centos7源码编译安装LAMP
- centos7.0安装lamp方法
- Navicat导入Excel文件字段对应的问题
- 【教程】PDF组件Spire.PDF 教程:如何在C#,VB.NET中将HTML样式化文本插入PDF
- 物体计数--Learning To Count Objects in Images
- 【JAVA开发之架构专题】11. 线程池原理
- java如何将json数据格式化输出到控制台
- 五分钟学GIS | Spark Streaming
- 编程感悟