LAMP环境搭建问题

//////////////////////////LAMP环境搭建问题///////////////////////////////////////
LAMP常见的问题
A.安装相关问题
(1)MySQL
a. error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解决办法 yum install -y libaio-devel

b. ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
解决办法 替换掉系统原来自带的 my.cnf :
mv /etc/my.cnf /etc/my.cnf_bak (原因未知,MySQL版本号为 mysql-5.5.52-linux2.6-x86_64)

(2)Apache
a. configure: error: no acceptable C compiler found in $PATH
解决办法,安装gcc
b. 网页里面访问网页出现forbidden
1.查看主配置文件,如果是Deny from all,改为Allow
对于php7.0来说,默认是Require all denied,我们需要把denied改为granted
(3)PHP
a.Sorry, I cannot run apxs. Possible reasons follow:
The output of /usr/local/apache2/bin/apxs follows:
./configure: /usr/local/apache2/bin/apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory
解决办法:因为没安装perl,先 yum install -y perl-devel ,然后修改apxs文件 ,把最上面一行改为/usr/bin/perl 解决

b.上述安装步骤所需要的包
configure: error: xml2-config not found. Please check your libxml2 installation.
yum install -y libxml2-devel
configure: error: Cannot find OpenSSL's <evp.h>
yum install -y openssl openssl-devel
   configure: error: Please reinstall the BZip2 distribution,
yum install -y bzip2 bzip2-devel
   configure: error: jpeglib.h not found.
yum install -y libjpeg-devel
   configure: error: png.h not found.
yum install -y libpng libpng-devel
   configure: error: freetype-config not found.
yum install -y freetype freetype-devel
   configure: error: mcrypt.h not found. Please reinstall libmcrypt.
yum install -y libmcrypt-devel

c.动态编译memcache
使用 /usr/local/php/bin/phpize 后报错:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
解决办法:
yum install -y autoconf

B.日常使用问题
(1)MySQL
a. 在一次实验当中,不知道什么原因出现了错误
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
在网上排除了挺久的也没找到结果,然后在/data/mysql文件夹里面偶然间瞄到了一个错误日志,/data/mysql/主机名.error,错误日志如下
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
显然,MySQL没有权限访问这个文件,排查出整个data文件夹权限全部为root,修改权限后解决问题
(论错误日志的重要性)

(2)Apache
第一次访问,出现Forbidden403,修改主配置文件的Deny all

(3)PHP
a.遇到php无法解析
1.先查看 /usr/local/apache2/bin/apachectl -M |grep 'php' ,看一下有没有装载 php5_module
2.查看配置文件 /usr/local/apache2/conf/httpd.conf ,看一下有无 AddType application/x-httpd-php .php
3.getenforce ,看看是否关闭了防火墙

b.如果出现时区的问题,在配置文件的timezone里面修改 /Asia/Chongqing

posted @ 2016-11-27 21:37  ImJerryChan  阅读(234)  评论(0编辑  收藏  举报