linux下PHP7环境搭建
LAMP环境版本
- 操作系统:Centos 7
- Mysql:5.7.11
- Apache:2.4.18
- PHP:7.0.4
安装Mysql
为mysql创建专属帐号
- shell> groupadd mysql
- shell> useradd -r -g mysql -s /bin/false mysql
源码编译安装
- shell> tar zxvf mysql-5.7.11.tar.gz
- shell> cd mysql-5.7.11
- shell> cmake .
- shell> make
- shell> make install
安装后设置
- shell> cd /usr/local/mysql
- shell> chown -R mysql . #修改目录所有者为mysql
- shell> chgrp -R mysql . #修改目录所属组为mysql
- shell> bin/mysqld --initialize-insecure --user=mysql --datadir=/data/mysql #初始化mysql,初始化为空,数据库存放目录指定为/data/mysql
- shell> bin/mysql_ssl_rsa_setup #启动ssl加密方式连接
- shell> chown -R root . #修改目录所有者为root
- shell> chown -R mysql /data/mysql #修改数据库目录所有者为mysql
安装mysql服务
- shell> cp support-files/mysql.server /etc/init.d/mysql.server
- shell> service mysql start #启动服务
安装Apache
源码编译安装
- shell> ./configure --prefix=/usr/local/apahche \
- --enable-so #动态共享对象,可实现模块动态生效 \
- --enable-rewrite #启用Rewrite功能 \
- --enable-ssl #支持SSL/TLS,可以实现https访问 \
- --enable-deflate #支持压缩 \
- shell> make
- shell> make install
apache的启动与关闭
- shell> /usr/local/apache/bin/apachectl start #启动
- shell> /usr/local/apache/bin/apachectl stop #停止
- shell> /usr/local/apache/bin/apachectl restart #重启
将apache添加到Linux的服务并设置自启动
- shell> cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd #设置为系统服务
- shell> ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S80httpd #在启动级别3中自启动
- shell> service httpd restart #通过服务来重启apache
运行测试页面
常见问题
- configure: error: APR not found.
解决方法: 安装对应依赖库
- shell> yum install apr apr-util-devel
- configure: error: pcre-config for libpcre not found.
解决方法:安装对应依赖库
- yum install pcre pcre-devel
- 启动apache时报:AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.44.13.173. Set the 'ServerName' directive globally to suppress this message
解决方法:修改配置文件httpd.conf设置ServerName localhost:80
安装PHP
安装依赖库
- zlib
- shell> tar xf zlib.1.2.8.tar.gz
- shell> cd zlib.1.2.8
- shell> ./configure
- shell> make test
- shell> make install
- GD库
libpng
- shell> tar xf libpng-1.6.21
- shell> cd libpng-1.6.21
- shell> ./configure --prefix=/usr/local/libpng
- shell> make
- shell> make check
- shell> make install
jpeg
- shell> tar xf jpegsrc.v9.tar.gz
- shell> cd jpeg-9
- shell> ./configure --prefix=/usr/local/libjpeg
- shell> make
- shell> make install
- libcurl-devel
- yum install libcurl-devel
- openssl-devel
- yum install openssl-devel
- libxslt-devel
- yum install libxslt-devel
- libxml2-devel
- yum install libxml2-devel
- freetype 字体操作库
- shell> tar xf freetype-2.6.3.tar.bz2
- shell> sh autogen.sh
- shell> ./configure --prefix=/usr/local/freetype
- shell> make
- shell> make install
编译安装PHP
- ./configure --prefix=/usr/local/php \
- --with-apxs2=/usr/local/apache/bin/apxs \
- --with-curl \
- --with-freetype-dir=/usr/local/freetype \
- --with-gd \
- --with-gettext \
- --with-iconv-dir \
- --with-mysqli \
- --with-openssl \
- --with-pcre-regex \
- --with-pdo-mysql \
- --with-pdo-sqlite \
- --with-pear \
- --with-png-dir=/usr/local/libpng \
- --with-jpeg-dir=/usr/local/libjpeg \
- --with-xsl \
- --with-zlib \
- --enable-fpm \
- --enable-bcmath \
- --enable-libxml \
- --enable-inline-optimization \
- --enable-gd-native-ttf \
- --enable-mbregex \
- --enable-mbstring \
- --enable-opcache \
- --enable-pcntl \
- --enable-shmop \
- --enable-soap \
- --enable-sockets \
- --enable-sysvsem \
- --enable-xml \
- --enable-zip
- shell> make
- shell> make install
PHP安装成功后会在apache的modules目录下生成一个libphp.so动态库文件,在apache的配置文件httpd.conf里自动增加一行
- LoadModule php7_module modules/libphp7.so
在Apache的配置文件httpd.conf的<IfModule mime_module></IfModule>块里增加一行
- AddType application/x-httpd-php .php
在网站要目录/usr/local/htdocs里增加一个index.php测试文件内容如下:
- <?php
- phpinfo();
然后我们运行此文件,如果输出了phpinfo信息,证明我们安装成功。
linux下PHP7环境搭建的更多相关文章
- linux下LAMP环境搭建
++++++++++++++++++++++++++++++++++++++++++++++ linux下LAMP环境搭建 ++++++++++++++++++++++++++++++++++++++ ...
- 2017.7.18 linux下ELK环境搭建
参考来自:Linux日志分析ELK环境搭建 另一篇博文:2017.7.18 windows下ELK环境搭建 0 版本说明 因为ELK从5.0开始只支持jdk 1.8,但是项目中使用的是JDK 1 ...
- Linux 下LNMP环境搭建_【all】
LNMP = Linux + Nginx + Mysql + PHP 1.0 Linux环境搭建 Linux 系统安装[Redhat] 1.1. FastCGI介绍 1.什么是CGI(common g ...
- linux下LAMP环境搭建尝试
最近,学习搭建了LAMP服务环境,中间遇到了很多问题,经过不断摸索总算得以解决.为了大家少走弯路,现将相关经验进行总结. linux下软件安装分为自动安装和手动安装两种,自动安装借助工具如yum等,自 ...
- linux下PHP 环境搭建
linux下环境搭建 第一步 安装Apache2 sudo apt-get install apache2 第二步 安装PHP模块 sudo apt-get install php5 第三 ...
- linux下scrapy环境搭建
最近使用scrapy做数据挖掘,使用scrapy定时抓取数据并存入MongoDB,本文记录环境搭建过程以作备忘 OS:ubuntu 14.04 python:2.7.6 scrapy:1.0.5 D ...
- Linux 下LAMP环境搭建_【all】
LAMP = Linux + Apache + Mysql + PHP 0. Linux环境搭建 Linux 系统安装[Redhat] 1.http服务软件分类及企业实战用途介绍 静态程序: Apac ...
- Zedboard学习(二):zedboard的Linux下交叉编译环境搭建 标签: 交叉编译linuxzedboard 2017-07-04 23:49 19人阅读
环境准备 首先肯定是要下载xilinx-2011.09-50-arm-xilinx-linux-gnueabi.bin文件,这是官方提供的linux下交叉编译链安装文件,下载地址为:https://p ...
- Linux下-LNMP环境搭建博客网站(全过程)
通常我们所说的LNMP是指一个网站基本的组织框架,即Linux系统支持,Nginx静态服务,Mysql数据库支持以及PHP动态编程语言支持.目前Mysql数据库被Oracle数据库分析公司收购,其创始 ...
随机推荐
- 注意Android里TextView控件的一个小坑,用android:theme来设置样式时动态载入的layout会丢失该样式
注意Android里TextView控件的一个小坑,用android:theme来设置样式时动态载入的layout会丢失该样式 这个坑,必须要注意呀, 比如在用ListView的时候,如果在List_ ...
- linux 文件管理以及其相关指令
Linux简介 严格的来讲,Linux 不算是一个操作系统,只是一个 Linux 系统中的内核, 即计算机软件与硬件通讯之间的平台:Linux的全称是GNU/Linux,这才算是一个真正意义上的Lin ...
- plain framework 1 版本更新 1.0.2 增加打包插件
由于个别因素,该框架的文档没有及时的更新到博客上,但是离线的文档已经完成.本次更新对框架来说显得比较重要,因为在文档的编写过程中经过再次的阅读代码修复了不少错误,最主要的是统一了整个框架的标准风格.对 ...
- 使用 React.js 的渐进式 Web 应用程序:第 1 部分 - 介绍
使用 React.js 的渐进式 Web 应用程序:第 1 部分 - 介绍 使用 React.js 的渐进式 Web 应用程序:第 1 部分 - 介绍 来自译者 markzhai:大家也知道最近 ...
- uva10344 23 out of 5
Your task is to write a program that can decide whether you can nd an arithmetic expression consisti ...
- 实现PD控制
尝试为场加入PD控制 在之前的模拟中,需要最小化一个能量函数H. 这样做的原因是,由理想约束的特性(约束反力垂直于虚位移),对于不含体积蒙皮的情况,可以推出 对于表面点,有 J^T * Σfs = 0 ...
- linux下安装安装pcre-8.32 configure: error: You need a C++ compiler for C++ support
linux下安装安装pcre-8.32./configure --prefix=/usr/local/pcre 出现以下错误configure: error: You need a C++ compi ...
- Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
Validation failed for one or more entities. See 'EntityValidationErrors' property for more details. ...
- npm换源
作者一介布衣:http://yijiebuyi.com/blog/b12eac891cdc5f0dff127ae18dc386d4.html npm 是node.js 环境下的包管理器,非常强大智能. ...
- [转]PHP 下使用 ZeroMQ 和 protobuf
FROM : http://www.68idc.cn/help/makewebs/php/20150118175432.html 前言 这个记录总的来说分两部分: 搭建环境. 简单使用教程. 搭建环境 ...