LAMP搭建错误总结

安装apache和mysql问题总结:


问题1:make时候出现:error:png.h:no such file or directory....

#vi ./gd_png.c   
把内容#include  "png.h" 替换成 #include "/usr/local/libpng/include/png.h"
再次make&&make install

测试:

重启apache,访问http://192.168.*.*
//若无法显示网页则检查是否iptables和selinux开启。关闭重试,安装成功则会显示it works!。

问题2:

[luoshen@apacheServer soft]$ /opt/apache2.4/bin/apachectl  start
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs

这个错误是因为没加sudo权限


问题3:

# rpm -ivh  MySQL-server-5.6.16-1.el6.i686.rpm  MySQL-client-5.6.16-1.el6.i686.rpm  MySQL-devel-5.6.16-1.el6.i686.rpm 
Preparing...                ########################################### [100%]
        package MySQL-devel-5.6.16-1.el6.i686 is already installed
        package MySQL-client-5.6.16-1.el6.i686 is already installed
        file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-

5.6.16-1.el6.i686 conflicts with file from package mysql-libs-5.1.73-

3.el6_5.i686
        file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-

5.6.16-1.el6.i686 conflicts with file from package mysql-libs-5.1.73-

3.el6_5.i686

。。。。。省略


# rpm -qa|grep mysql|xargs rpm -e
error: Failed dependencies:
libmysqlclient.so.16 is needed by (installed) postfix-2:2.6.6-6.el6_5.i686
libmysqlclient.so.16(libmysqlclient_16) is needed by (installed)postfix-2:2.6.6-6.el6_5.i686
mysql-libs is needed by (installed) postfix-2:2.6.6-6.el6_5.i686

# rpm -qa|grep mysql
mysql-libs-5.1.73-3.el6_5.i686

解决方法:已经有mysql-libs,yum remove卸载就好了,然后再rpm安装mysql-server。

安装正确显示:

[root@localhost soft]# rpm -ivh MySQL-server-5.6.16-1.el6.i686.rpm  MySQL-client-5.6.16-1.el6.i686.rpm  MySQL-devel-5.6.16-1.el6.i686.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [ 33%]
   2:MySQL-client           ########################################### [ 67%]
   3:MySQL-server           ########################################### [100%]

问题4:

[root@localhost soft]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: 

NO)
[root@localhost soft]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: 

NO)
[root@localhost soft]# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: 

NO)

修改root用户的密码,还是出现问题:

# mysqladmin -uroot -p password ’newpassword’ 
Enter password: 
mysqladmin: connect to server at ’localhost’ failed 
error: ’Access denied for user ’root’@’localhost’ (using password: YES)’ 

正确解决方法:

# /etc/init.d/mysql stop 
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 
# mysql -u root mysql 
    mysql>use mysql
    mysql> UPDATE user SET Password=PASSWORD('123456') where user='root'; 
    mysql> FLUSH PRIVILEGES; 
    mysql> quit 
# /etc/init.d/mysql restart 
# mysql -uroot -p 
    Enter password: <输入新设的密码newpassword> 
    mysql> 

因为我偷懒把密码设置为空,所以又出现下面的提示:

问题5:

[root@localhost soft]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.16

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> 

解决:

[root@localhost soft]# mysqladmin  -u root password 123456

问题6:

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

按照提示查看文件/root/.mysql_secret,发现有给出密码,用该密码登陆,再修改密码才能使用:

# cat /root/.mysql_secret 
# The random password set for the root user at Thu Feb 27 17:50:09 2014 (local time): BgQDexTU
# mysql -uroot -p BgQDexTU
    mysql> show databases;
    ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
    mysql> 

//正常修改密码不成功则使用上面的安全模式,但是设置新的密码登陆之后还是显示SET PASSWORD,要做如下操作重设密码才能正常访问 。

mysql> set password=password('newpassword');
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> 

ps:配置远程访问

处于安全考虑,Mysql默认是不允许远程访问的,可以使用下面开启远程访问

//赋予任何主机访问数据的权限

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION

//使修改生效

mysql>FLUSH PRIVILEGES

如果依然不能远程访问的话,那就很可能防火墙的原因了,可以在防火墙中开启3306端口或者干脆关掉防火墙。

rpm包安装的MySQL是不会安装/etc/my.cnf文件的,解决方法,只需要复制/usr/share/mysql目录下的my-huge.cnf 文件到/etc目录,并改名为my.cnf即可

# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

安装php问题总结:

问题1:

configure: error: wrong mysql library version or lib not found. Check 

config.log for more information.

修改:

--with-mysqli=mysqlnd 
--with-mysql=mysqlnd 

参考网址:http://www.litespeedtech.com/support/forum/threads/solved-compiling-php-5-3-6-with-lsapi-problem.4986/

问题2:

In file included from /usr/local/src/php-5.3.28/ext/standard/basic_functions.c:49:/usr/local/src/php-5.3.28/Zend/zend_language_parser.h:317: 错误:与‘zendparse’类型冲突
/usr/local/src/php-5.3.28/Zend/zend_globals_macros.h:35: 附注:‘zendparse’的上一个声明在此
make: *** [ext/standard/basic_functions.lo] 错误 1

解决:参数不一致问题

把zend_language_parser.h文件的
int zendparse (void);
修改为和zend_globals_macros.h文件的:
int zendparse (void *compiler_globals);一样

参考网址:http://nlyblog.com/Index-read-aid-33.html

问题3:

/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [libphp5.la] 错误 1

以上提示是libltdl没有编译安装,解决方法如下:

# cd libmcrypt-2.5.8/
# cd libltdl/
# ./configure  --enable-ltdl-install
# make && make install

/usr/local/src/php-5.3.28/sapi/cli/php: error while loading shared libraries: 

libltdl.so.3: cannot open shared object file: No such file or directory
make: *** [ext/phar/phar.php] 错误 127

解决:

# find / -name libltdl.so.3
/usr/local/lib/libltdl.so.3
/usr/local/src/libmcrypt-2.5.8/libltdl/.libs/libltdl.so.3
# cd /usr/local/lib/
ln -s libltdl.so.3 /usr/lib/libltdl.so
# make clean

再make && make install

若还是出错则修改/etc/ld.so.conf文件
追加如下一句(就这句,不要加别的)
/usr/local/lib

然后执行ldconfig命令,再编译

问题4:

/usr/local/src/php-5.3.28/build/shtool install -c ext/phar/phar.phar /usr/local/php//bin
cp: cannot stat `ext/phar/phar.phar': No such file or directory
make: *** [install-pharcmd] 错误 1

 mkdir ext/phar/phar.phar创建该目录就好了

问题5

--------------------------------------------------------

Sorry, I cannot run apxs. Possible reasons follow:

1. Perl is not installed

2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs

3. Apache was not built using --enable-so (the apxs usage page is displayed)

---------------------------------------------------

解决步骤:

1、根据不能run apxs 。cd 到apache的bin目录下运行./apxs 运行结果

----------------------------------------------------

bash: ./apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory

---------------------------------------------------------

2、vim apxs文件 找“/replace/with/path/to/perl/interpreter”关键字

在第一个行 :#!/replace/with/path/to/perl/interpreter -w

根据perl的安装目录 /usr/bin/perl

修改为:#! /usr/bin/perl -w

3、运行第一步。或者直接 ./configure ^^^^^

问题6

configure: error: png.h not found.(同类型的.h文件not found)
解决方法yum  install png-devel

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值