- 目录
- 1.LAMP架构介绍
- 2.MySQL_MariaDB介绍
- 3.MySQL安装
- 4.MariaDB安装
- 5.Apache安装
- 6.安装PHP5
- 7.安装PHP7
- 8.Apache和PHP结合
- 扩展
1.LAMP架构介绍
LAMP架构介绍
Linux+APache(httpd)+MySQL(存储数据软件)+PHP(脚本语言)
三个觉得可以在一台机器上、也可以封开(httpd和PHP要在一起)
httpd、PHP、MySQL三者如何工作
MySQL中不能存图片之类的文件。
2.MySQL_MariaDB介绍
MySQL是一个关系类型数据库,由mysql ab公司开发,mysql在2008年被sun公司收购(10亿刀),2009年sun公司被orache公司收购(74亿刀)
MySQL官网:www.mysql.com 最新版本5.7GA/8.0DMR
MySQL5.6变化比较大,5.7性能上有很大提升
Mariadb为MySQL的一个分支,官网:https://mariadb.coim
MaridDB主要由SkySQL公司维护,SkySQL公司由MySQL原作者带领大部分原班人马创立
Mariadb5.5版本对应MySQL的5.5,10.0对应MySQL5.6
Community社区版本,Enterprise企业版,GA(Generally Available)指通用版本,在生产环境中的,DMR(Development Milestone Release)开发里程碑发布版,RC(Release Candidate) 发行候选版本,Beta开放测试版本,Alpha内部测试版本
3.MySQL安装
MySQL的几个常用安装包:rpm、源码、二进制免编译
下载二进制安装包
[root@chenshi ~]# cd /usr/local/src/
[root@chenshi src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
[root@chenshi src]# ls
mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
解压安装包 tar zxvf
解压后移动目录并且改名
[root@chenshi src]# ls
mysql-5.6.36-linux-glibc2.5-x86_64 mysql-5.6.36.tar.gz
mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
[root@chenshi src]# mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql
[root@chenshi src]# cd /usr/local/mysql/
[root@chenshi mysql]# ls
bin data include man README share support-files
COPYING docs lib mysql-test scripts sql-bench
安装MySQL
报错……安装perl
[root@chenshi mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
-bash: ./scripts/mysql_install_db: /usr/bin/perl: 坏的解释器: 没有那个文件或目录
[root@chenshi mysql]# yum install -y perl
继续报错,搜索dumper相关的安装包。可以一个一个试试安装哪个包
[root@chenshi mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:
Data::Dumper
[root@chenshi mysql]# yum list|grep perl|grep -i dumper
perl-Data-Dumper.x86_64 2.145-3.el7 base
perl-Data-Dumper-Concise.noarch 2.020-6.el7 epel
perl-Data-Dumper-Names.noarch 0.03-17.el7 epel
perl-XML-Dumper.noarch 0.81-17.el7 base
[root@chenshi mysql]# yum install -y perl-XML-Dumper.noarch
安装yum-y install autoconf 包
继续报错
Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
安装依赖包
[root@chenshi mysql]# yum install libaio* -y
安装成功
[root@chenshi mysql]# echo $?
0
拷贝配置文件
[root@chenshi mysql]# ls support-files/
binary-configure magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server
[root@chenshi mysql]# cp support-files/my-default.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y
[root@chenshi mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@chenshi mysql]# vi /etc/init.d/mysqld
修改mysqld中的这两个选项
basedir=/usr/local/mysql
datadir=/data/mysql
开机启动
[root@chenshi mysql]# chkconfig --add mysqld
[root@chenshi mysql]# chkconfig --list
注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。
如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。
欲查看对特定 target 启用的服务请执行
'systemctl list-dependencies [target]'。
mysqld 0:关 1:关 2:开 3:开 4:开 5:开 6:关
netconsole 0:关 1:关 2:关 3:关 4:关 5:关 6:关
network 0:关 1:关 2:开 3:开 4:开 5:开 6:关
启动mysql报错
[root@chenshi mysql]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/data/mysql/chenshi.err'.
ERROR! The server quit without updating PID file (/data/mysql/chenshi.pid).
用虚拟机重新安装后成功启动
[root@localhost mysql]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/data/mysql/localhost.localdomain.err'.
SUCCESS!
[root@localhost mysql]# ps aux|grep mysql
root 1333 0.0 0.0 113308 1604 pts/0 S 22:35 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pid
mysql 1470 1.1 24.1 1300832 449596 pts/0 Sl 22:35 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/localhost.localdomain.err --pid-file=/data/mysql/localhost.localdomain.pid --socket=/tmp/mysql.sock
root 1494 0.0 0.0 112720 984 pts/0 R+ 22:35 0:00 grep --color=auto mysql
尝试修改真机中的my.cnf文件依旧失败。。。不明觉厉
真机重装后启动成功
root@chenshi mysql]# vim /etc/init.d/mysqld
[root@chenshi mysql]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/data/mysql/chenshi.err'.
SUCCESS!
my.cnf文件内容
[root@chenshi ~]# cat /etc/my.cnf
[mysqld]
datadir=/data/mysql
socket=/tmp/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
查看mysqld是哪个端口
[root@chenshi ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 835/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1385/master
tcp6 0 0 :::3306 :::* LISTEN 9763/mysqld
tcp6 0 0 :::22 :::* LISTEN 835/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1385/master
当使用命令行启动服务时只能用killall命令结束服务;killall相对kill命令更安全。 如果发现killall mysqld一直没有彻底关闭则是一直在写数据,等数据写入成功后会自动关闭。强制关闭可能造成表的损坏。
4.MariaDB安装
下载Mariadb的二进制包
[root@chenshi ~]# cd /usr/local/src
[root@chenshi src]# wget https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
安装MariaDB
[root@chenshi mariadb]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mariadb
.
.
[root@chenshi mariadb]# echo $?
0
拷贝配置文件
[root@chenshi mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
[root@chenshi mariadb]# cp support-files/mysql.server /etc/init.d/mariadb
my.cnf基本不用修改,修改启动配置文件(定义basedir、datadir、conf还有启动配置文件$bindir/mysqld_safe --defaults-file="$conf")
[root@chenshi mariadb]# vim /etc/init.d/mariadb
basedir=/usr/local/mariadb
datadir=/data/mariadb
conf=/usr/local/mariadb/my.cnf
case "$mode" in
'start')
# Start daemon
# Safeguard (relative paths, core dumps..)
cd $basedir
echo $echo_n "Starting MySQL"
if test -x $bindir/mysqld_safe
then
# Give extra arguments to mysqld with the my.cnf file. This script
# may be overwritten at next upgrade.
$bindir/mysqld_safe --defaults-file="$conf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" &
查看是否有mysql的服务在运行,否则启动Mariadb会和mysql冲突
[root@chenshi mariadb]# /etc/init.d/mariadb start
Starting mariadb (via systemctl): Warning: mariadb.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[ 确定 ]
检查服务是否启动
[root@chenshi mariadb]# ps aux|grep -i mariadb
root 13546 0.0 0.0 115380 1744 ? S 11:01 0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mysql --pid-file=/data/mysql/chenshi.pid
mysql 13662 1.1 0.5 1583872 57880 ? Sl 11:01 0:00 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/data/mysql --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mysql/chenshi.err --pid-file=/data/mysql/chenshi.pid --socket=/tmp/mysql.sock --port=3306
root 13729 0.0 0.0 112664 972 pts/1 R+ 11:01 0:00 grep --color=auto -i mariadb
查看端口
[root@chenshi mariadb]# netstat -ltnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 835/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1385/master
tcp6 0 0 :::3306 :::* LISTEN 13662/mysqld
tcp6 0 0 :::22 :::* LISTEN 835/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1385/master
当一台机器上有mysql和Mariadb时可以修改Mariadb的my.cnf文件(不修改的话会报错)
[root@chenshi mariadb]# vi /usr/local/mariadb/my.cnf
[mysqldump]
datadir = /data/mariadb
定义好datadir后再次启动服务,没有报错
[root@chenshi mariadb]# /etc/init.d/mariadb start
Starting mariadb (via systemctl): [ 确定 ]
5.Apache安装
Apache是一个基金会的名字,httpd才是要安装的软件包,早期它的名字叫apache
Apache官网www.apache.org
下载Apache2.4源码包、apr包、apr-util包
[root@chenshi src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz
.
.
[root@chenshi src]# wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz
.
.
[root@chenshi src]# wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.bz2
.
.
[root@chenshi src]# ls
apr-1.6.3.tar.gz mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
apr-util-1.6.1.tar.bz2 mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
httpd-2.4.33.tar.gz mysql-5.6.36.tar.gz
解压后安装apr
[root@chenshi src]# cd apr-1.6.3/
[root@chenshi apr-1.6.3]# ./configure --prefix=/usr/local/apr
由于没有安装gcc工具,所以导致报错yum install -y gcc
[root@chenshi apr-1.6.3]# echo $?
0
[root@chenshi apr-1.6.3]# make && make install
[root@chenshi src]# ls /usr/local/apr/
bin build-1 include lib
[root@chenshi apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
.
.
.
[root@chenshi apr-util-1.6.1]# make && make install
.
.
make报错;缺少expat库 yum install expat-deve -y ,安装后make 成功
[root@chenshi apr-util-1.6.1]# echo $?
0
安装httpd
[root@chenshi apr-util-1.6.1]# cd ..
[root@chenshi src]# cd httpd-2.4.33/
[root@chenshi httpd-2.4.33]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
中间报错pcre,使用yum list|grep pcre,安装所需求的包后安装成功(pcre-devel.x86_64)
[root@chenshi httpd-2.4.33]# echo $?
0
make后报错
make[2]: *** [htpasswd] 错误 1
make[2]: 离开目录“/usr/local/src/httpd-2.4.33/support”
make[1]: *** [all-recursive] 错误 1
make[1]: 离开目录“/usr/local/src/httpd-2.4.33/support”
make: *** [all-recursive] 错误 1
[root@chenshi httpd-2.4.33]# echo $?
2
解决方案
问题!!make报错
collect2: error: ld returned 1 exit status
make[2]: [htpasswd] 错误 1
make[2]: 离开目录“/usr/local/src/httpd-2.4.27/support”
make[1]: [all-recursive] 错误 1
make[1]: 离开目录“/usr/local/src/httpd-2.4.27/support”
make: *** [all-recursive] 错误 1
解决办法:
cd /usr/local/src/
cp -r apr-1.6.2 /usr/local/src/httpd-2.4.27/srclib/apr
cd apr-1.6.3
./configure --prefix=/usr/local/apr
make && make install
cp -r apr-util-1.6.0 /usr/local/src/httpd-2.4.27/srclib/apr-util
cd /usr/local/src/apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
cd /usr/local/src/httpd-2.4.27
#./configure --with-included-apr --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
#make &&make install
安装完成
.
.
make[1]: 离开目录“/usr/local/src/httpd-2.4.33”
[root@chenshi httpd-2.4.33]# echo $?
0
[root@chenshi httpd-2.4.33]# cd /usr/local/apache2.4/
[root@chenshi apache2.4]#
[root@chenshi apache2.4]# ls
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
bin文件夹中存放着核心的二进制文件;conf目录时存放配置文件;htdoc存放网站服务;logs日志相关目录;modules存放扩展模块。
如何查看apache都加载了哪些模块
[root@chenshi apache2.4]# /usr/local/apache2.4/bin/httpd -M
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::aaa1:7b9b:94d0:c3e5. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_event_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)
shared表示是扩展文件,static表示在本目录的模块
启动apache
[root@chenshi apache2.4]# /usr/local/apache2.4/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::aaa1:7b9b:94d0:c3e5. Set the 'ServerName' directive globally to suppress this message
httpd (pid 14775) already running
[root@chenshi apache2.4]# ps aux |grep httpd
root 14775 0.0 0.0 95588 2532 ? Ss 12:38 0:00 /usr/local/apache2.4/bin/httpd
daemon 14783 0.0 0.0 382416 4428 ? Sl 12:38 0:00 /usr/local/apache2.4/bin/httpd
daemon 14784 0.0 0.0 382416 4432 ? Sl 12:38 0:00 /usr/local/apache2.4/bin/httpd
daemon 14785 0.0 0.0 382416 4432 ? Sl 12:38 0:00 /usr/local/apache2.4/bin/httpd
root 14899 0.0 0.0 112728 964 pts/1 R+ 12:41 0:00 grep --color=auto httpd
[root@chenshi apache2.4]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 835/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1385/master
tcp6 0 0 :::3306 :::* LISTEN 14243/mysqld
tcp6 0 0 :::80 :::* LISTEN 14775/httpd
tcp6 0 0 :::22 :::* LISTEN 835/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1385/master
apache默认监听80端口
6.安装PHP5
PHP官网www.php.net
当前主流版本5.6/7.1
下载安装php
[root@chenshi php-5.6.32]# wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2
.
.
[root@chenshi php-5.6.32]# tar -jxvf php-5.6.32.tar.bz2
[root@chenshi src]# cd php-5.6.32/
[root@chenshi php-5.6.32]#
安装PHP
[root@chenshi php-5.6.32]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdpo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
+--------------------------------------------------------------------+
| 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.
config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
在安装好多包之后。编译成功了
安装PHP;make install
[root@chenshi php-5.6.32]# make install
/bin/sh /usr/local/src/php-5.6.32/libtool --silent --preserve-dup-deps --mode=install cp ext/opcache/opcache.la /usr/local/src/php-5.6.32/modules
Installing PHP SAPI module: apache2handler
/usr/local/apache2.4/build/instdso.sh SH_LIBTOOL='/usr/local/apache2.4/build/libtool' libphp5.la /usr/local/apache2.4/modules
/usr/local/apache2.4/build/libtool --mode=install install libphp5.la /usr/local/apache2.4/modules/
libtool: install: install .libs/libphp5.so /usr/local/apache2.4/modules/libphp5.so
libtool: install: install .libs/libphp5.lai /usr/local/apache2.4/modules/libphp5.la
libtool: warning: remember to run 'libtool --finish /usr/local/src/php-5.6.32/libs'
chmod 755 /usr/local/apache2.4/modules/libphp5.so
[activating module `php5' in /usr/local/apache2.4/conf/httpd.conf]
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
Installing PHP CLI binary: /usr/local/php/bin/
Installing PHP CLI man page: /usr/local/php/php/man/man1/
Installing PHP CGI binary: /usr/local/php/bin/
Installing PHP CGI man page: /usr/local/php/php/man/man1/
Installing build environment: /usr/local/php/lib/php/build/
Installing header files: /usr/local/php/include/php/
Installing helper programs: /usr/local/php/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php/lib/php/
[PEAR] Archive_Tar - already installed: 1.4.3
[PEAR] Console_Getopt - already installed: 1.4.1
[PEAR] Structures_Graph- already installed: 1.1.1
[PEAR] XML_Util - already installed: 1.4.2
[PEAR] PEAR - already installed: 1.10.5
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/usr/local/src/php-5.6.32/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
[root@chenshi php-5.6.32]# echo $?
0
php目录下的文件
[root@chenshi ~]# ls /usr/local/php
bin etc include lib php
[root@chenshi ~]# ls /usr/local/php/bin
pear peardev pecl phar phar.phar php php-cgi php-config phpize
拷贝php的配置文件 cp php.ini-production /usr/local/php/etc/php.ini
查看php加载了哪些模块
[root@chenshi ~]# /usr/local/php/bin/php -m
[PHP Modules]
bz2
Core
ctype
date
dom
ereg
exif
fileinfo
filter
gd
hash
iconv
json
libxml
mbstring
mcrypt
mysql
mysqli
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
7.安装PHP7
下载并解压php7
[root@chenshi src]#wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
[root@chenshi src]#tar jxvf php-7.1.6.tar.bz2
编译源码包
./configure --prefix=/usr/local/php --with-apxs2=/usr/loca7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-mysqli=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
安装成功
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
[root@chenshi php-7.1.6]# echo $?
0
[root@chenshi php-7.1.6]# ls /usr/local/apache2.4/modules/libphp
libphp5.so libphp7.so
和php5安装方法基本一致;同时安装了PHP5和7的需要注释掉7
8.Apache和PHP结合
httpd主要配置文件 /usr/local/apache2.4/conf/httpd.conf
需要编辑server name;去除#号
AllowOverride none
Require all granted
增加一行
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
依旧解析不了……从头再来……
成功了
增加索引页
DirectoryIndex index.html index.php
尝试写一个php文件内容如下
[root@chenshi php-5.6.32]# vi /usr/local/apache2.4/htdocs/1.php
~
~
解析成功
如果不能解析的话访问显示源代码,检查apache配置文件(apache加载项、配置文件,是否格式错误)
检查语法
/usr/local/apache2.4/bin/apachectl -t
discuz设置
https://www.cnblogs.com/sos-blue/p/6852945.html
https://jingyan.baidu.com/article/b87fe19eb57ff252183568d9.html
扩展
mysql5.5源码编译安装 http://www.aminglinux.com/bbs/thread-1059-1-1.html
mysql5.7二进制包安装(变化较大) http://www.apelearn.com/bbs/thread-10105-1-1.html
apache dso https://yq.aliyun.com/articles/6298
apache apxshttp://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/programs/apxs.html
apache工作模式 http://www.cnblogs.com/fnng/archive/2012/11/20/2779977.html
php中mysql,mysqli,mysqlnd,pdo到底是什么http://blog.csdn.net/u013785951/article/details/60876816
查看编译参数 http://ask.apelearn.com/question/1295