Q: ERROR 1130 (00000): Host X is not allowed to connect to this MySQL server

A: 这种问题一般出现在远程登录数据库的时候。原因是由于连接mysql数据库的用户名的权限不够,可以在服务器上用root用户登录,查看mysql数据库的user表,修改对应用户的host列的值为%(默认的为localhost)。相应的sql语句为:

     use mysql;
     update user set host='%' where user='connect name';
     flush privileges;
     exit

Q: Ubuntu 下安装phpmyadmin 却无法使用

A: 安装phpmyadmin命令:
sudo apt-get install phpmyadmin
    默认安装在 /usr/share/phpmyadmin
    作个链接到 /var/www/ 目录下,命令为:sudo ln -s /usr/share/phpmyadmin/ /var/www/
    再使用 [url]http://localhost/phpmyadmin[/url] 即可以访问了。

Q: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

A:这是一个 warning,出现在apache2启动或重起时。主要是因为在配置 apache2 时,没有指定相应的主机名,即 ServerName。修改 /etc/apache2/httpd.conf , 在最前加入 ServerName localhost:80 即可。

Q: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

A:这是由于在页面中使用 session_start() 的位置没有放对,按官方文档的说法:If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser
所以,可以把<?php session_start();?>放在页面的最前面即可,注意<?php 前不要有空格。

Q: Warning: Cannot modify header information - headers already sent

A:由于在页面中使用了 header() ,按官方文档 的说法: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
另外对于 header("Location:") 的用法,在下一行用exit;以使后面的内容不会被执行。
如:
<?php
header
("Location: [url]http://www.example.com/[/url]"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>