搭建lamp环境Q&A

Q1:no acceptable C compiler found in $PATH

A:yum -y install gcc

Q2:红帽没有注册,无法使用yum

A:
vim /etc/yum.repo.d/XXXX.repo 将第一行的 -$basearch-debug 删除 将第二行的url=后面的内容替换为http://mirrors.163.com/centos/5/os/i386/ enbaled=0换成1 GPG-KEY修改成http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5 保存退出(wq) 试试yum list看看是否可以使用

Q3:yum安装软件包出现HTTP Error 404 NOT FOUND错误的办法

A:
将mirrors.163.com的IPv4地址写入到/etc/hosts
[root@localhost ~]# echo `host mirrors.163.com|cut -d' ' -f 4` mirrors.163.com >> /etc/hosts

# yum clean all
# rpm --rebuilddb
# yum update

Q4:apache重启报错

Q:
重启报错:/usr/local/apache/bin/apachectl restart httpd: Syntax error on line 152 of /usr/local/apache/conf/httpd.conf: Cannot load modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied A: 起因:SELinux保护模式引起的 1、关闭SELINUX的方法: 编辑/etc/selinux/config,找到这段: # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=enforcing 把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为: SELINUX=disabled 保存,关闭。 编辑/etc/sysconfig/selinux,找到: # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=enforcing 如果SELINUX已经是 SELINUX=disabled,那么就不用改了,否则就把SELINUX=enforcing 注释掉,新加一行: SELINUX=disabled 保存,退出。重启 如果你碰到其他类似提示: cannot restore segment prot after reloc: Permission denied 哪应该是SELinux的问题,可以考虑把它关闭。 2、不关闭SELINUX的方法: # setenforce 0 # chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache/modules/libphp5.so # service httpd restart # setenforce 1 实验了一下确实管用apapche启动正常,php正常显示。

参考

Q5:找不到GD库

A:
cd /lamp/php-5.6.13/ext/gd/
../../scripts/phpize
./configure --prefix=/usr/local/php/ --with-php-config=/usr/local/php/bin/php-config
make
make install

find / -name "gd.so"
/usr/local/php/lib/php/extensions/no-debug-zts-20131226/gd.so

vim /etc/php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-zts-20131226/gd.so

此时:可以看到GD库

posted @ 2016-02-05 11:25  andr01la  阅读(184)  评论(0编辑  收藏  举报