您的位置:首页 > 编程语言 > PHP开发

PHP开发常见问题解决列表

2013-12-06 13:37 330 查看

1. 学习Zend Framework tutorial过程中的问题

(1)执行"zf create project zf-tutorial"出现如下错误:

'"php.exe"' is not recognized as an internal or external command, operable program or batch file.

解决办法:原因是因为php.exe所在的路径没有加到系统环境变量Path中。加入后即可解决。

(2)访问http://localhost/zf-tutorial/public时出现403Forbidden错误。这个问题搞了我很久,最后发现是public下的.htaccess配置不当造成的,将文件内容替换为如下就可以解决了。目前源文件配置较为复杂,没看懂,先解决问题再继续研究。

RewriteEngine on
RewriteRule !/.(js|ico|gif|jpg|png|css)$ index.php

2. 安装phpMyAdmin3.0过程中的问题

(1)The configuration file now needs a secret passphrase (blowfish_secret);

解决办法:在phpmyadmin目录下的config.inc.php文件中,修改

$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

为:

$cfg['blowfish_secret'] = 'holla'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! *

3、It is not safe to rely on the system's timezone settings

在写php程序中有时会出现这样的警告:PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in D:\PHPWEB\news\file.php on line 17 。
这是因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入格林威治标准时间和北京时间大概差8个小时左右,我们可以按照下面的方法解决:
1、在页头使用date_default_timezone_set()设置我的默认时区为北京时间,即<?phpdate_default_timezone_set("PRC");?>就可以了。
2、在php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。

4、Property "CWebApplication.errorHandler" is read only.

Quote
CException
Property "CWebApplication.errorHandler" is read only.

D:\WAMPx64\www\yii\framework\base\CModule.php(467)

467 $this->$key=$value;


Check in your config file (protected/config/main.php) that the "errorHandler" configuration is inside the components section... seems it's outside... and that's why you are getting this error...

5、Yii框架下的空白页问题,IE访问testdrive/index.php?r=post/query时,是一个空白页问题

错误原因是:在PostController中,重叠定义了ActionID,导致了PostController中所有的ActionID都无效了。如下面我的代码中两个重叠的edit方法

public function actionEdit()
{
echo 'edit';
}

public function actions()
{
return array(
'edit'=>'application.controller.post.UpdateAction'
);
}

public function actionEdit()
{
$post = Post::model()->findByPk(10);
$post->title='test';
$post->save();
}

public function actionQuery()
{
...

}

//其他方法



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: