解决php空白页

1、修改PHP配置文件 php.ini

short_open_tag = Off 修改为 On   //打开短标签,默认一般都是打开

<?php  //完整标签
<? php phpinfo(); ?>

<?          //短标签
<? phpinfo(); ?>

2、查看apache的error日志

3、查看空白页面的源文件
如果有任何代码,那可能是编码问题(在meta标签)。如果查看的源文件就是空的,那么就是其它程序问题。

4、如果看到phpinfo,但是比如phpmyadmin等等的首页都是空白页,这就要修改php.ini打开display_errors = On 再次访问页面就可以看到require(./…这样的语句无法执行,提示找不到文件(就是No such file),根据提示错误修改。一般这个方法比较实用,而且能找出根本原因。

以下是Google之的资料:

我们在Linux主机上安装一些PHP应用程序的时候,如dedecms、discuz 或其他的php程序,经常会遇到空白页面的问题,如果要解决这样的问题:

首先,第一步要确定 php.ini 中的 error_display 配置选项是否设置为 On,如果不是就请马上改过来;然后,在程序中找到 error_reporting 函数,将其参数改为 E_ALL,如果没有找到该函数,就在 PHP 程序的第一行写入
error_reporting(E_ALL);
现在,应该可以看到程序的错误提示,依据这些信息来判断程序的错误原因,通常都是一些常见错误,如果是那种情况就很好解决啦!例如:
Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at /home/www/hosteguide.com/cms/php/inc_login.php:19) in /home/www/hosteguide.com/cms/php/server.php on line 3
这一类问题的原因是,你在程序中使用 session_start() 之前,已经有实际的 HTML 内容输出了,类似 echo 或 print 一条消息了,解决此类问题的办法是,将你的 session_start() 调到程序的第一行;如果这样还是不行,那么,就是属于如题所示的 PHP 程序问题。

第一种情况,在你的程序中使用 session_start() 函数之前没有使用过 header() 函数,并且也没有任何的 HTML 输出,只是 include 了一些 PHP 文件,但在这些 PHP 文件中也没有 header() 函数以及任何的 HTML 输出;对于这种情况,你是否用光标键在 ?> 这个 PHP 代码结束语句后移动检查过呢?如果发现在 ?> 这个后面有空行或几个空格,删除这几个空行或空格,那么问题就解决了;如果你检查之后发现不是这个问题,那么,可能是因为你的 PHP 文件是 UTF8 编码的,其实是 UTF8 编码不是问题所在,问题出在 UTF8 文件最前面可能会有三字节 BOM(Byte Order Mark) 的签名,使用文本编辑器无法看到和编辑它,但是页面还是有输出的,当在 header、setcooke、session_start 等时会产生错误和警告,建议使用 UltraEdit、EmEditor 或者 dreamweaver 来清除它。

第二种情况,这已经不属于 PHP 程序问题,但是对于菜鸟来说,并没有区别;这是属于 HTML 页面编码方面的问题,我曾经遇到过,当时也认为是程序出错了,很是头痛,在这里与大家分享一下经验。将 <meta http-equiv=content-type content=”text/html; charset=UTF-8″> 调整到 <head> 后面,要紧挨着 <head> 后面,为什么会这样呢,这与 DOCTYPE 声明有关,即在你的模板中使用了
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
DOCTYPE 是 document type 的简写,主要用来说明你用的 XHTML 或者 HTML 是什么版本,浏览器根据你 DOCTYPE 定义的 DTD (文档类型定义)来解释页面代码,所以,如果你不注意设置了错误的 DOCTYPE,结果会让你大吃一惊。

redhat关机时停留在system halted

在一台老式pc机上安装的redhat5.3,关机的时候一直停留在system halted ,不能正常关机,Google之~

解决方法:

修改/boot/grub/grub.conf配置文件,在kernel部分修改:
 root=LABEL=/ apm=on apm=power-off rhgb quiet
重启即可。

APM = Advanced Power Management,高级电源管理,一种工业标准,它允许系统处理器和各个组件进入省电模式,包括挂起、睡眠和关机。

Could not load file or assembly ‘Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. 系统找不到指定的文件

Server Error in ‘/’ Application.
——————————————————————————–

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly ‘Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. 系统找不到指定的文件。

Source Error:
Line 25:             以标识传入的用户。
Line 26:         –>
Line 27:     <add assembly=”Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C”/>
Line 28:     <add assembly=”Microsoft.Vbe.Interop, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C”/>
Line 29:     <add assembly=”office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C”/>
 

Source File: D:\wz\soft\web\web.config    Line: 27

Assembly Load Trace: The following information can be helpful to determine why the assembly ‘Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
——————————————————————————–
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

解决方法:

安装office2007 (推荐专业版,安装的时候尽量选择“立即安装”不要选择“自定义”)

网站需要加载office2007的excel组件,服务器上没有,所以报错!

配置mysql数据库双向同步

       mysql数据库的双向同步其实就是将主从的配置关系,在单向基础上颠倒过来配置一遍。
比如数据库s1和s2,s1的角色变成了主+从,s2的角色变成了从+主
配置方法如下:
S1配置:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

#A TO B
log-bin=mysql-bin
server-id=1
binlog-do-db=NQ

#B TO A
server-id=1
master-host=192.168.1.3
master-user=root
master-password=root
master-port=3306
master-connect-retry=60
replicate-do-db=NQ

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

S2配置:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

#A TO B
server-id=2
master-host=192.168.1.2
master-user=root
master-password=root
master-port=3306
master-connect-retry=60
replicate-do-db=NQ

#B TO A

log-bin=mysql-bin
binlog-do-db=NQ

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
大家可以参考/usr/share/mysql/my-huge.cnf的配置文件,并且其中有相关的注释,可以明白各参数作用。
在此就不讲双向同步的配置代码含义了。
在s1和s2中通过phpmyadmin进行测试,双向都能同步成功即可。