一、错误提示
在安装ThinkPHP时,常常会出现以下错误提示:
无法打开压缩文件(open_basedir限制)
程序执行的时候提示告警:
立即学习“PHP免费学习笔记(深入)”;
点击下载“电脑DLL/驱动修复工具”;
Warning: require(D:wampwww hinkphpindex.php): failed to open stream: No such file or directory in D:wampwww hinkphp est.php on line 2
程序执行的时候提示错误:
Fatal error: Class 'PDO' not found in /path/to/thinkphp/ThinkPHP/Library/Think/Db/Driver.class.php on line 34
二、解决方法
无法打开压缩文件
这是由于系统的open_basedir限制造成的。我们无法解压缩文件,这是因为系统出于安全考虑关闭了PHP中的系统函数。我们可以通过以下两种方式来解决这个问题。
方法一:修改php.ini配置文件
打开apache配置文件夹(例如:D:wampinapacheApache2.2.21conf),找到php.ini,在php.ini中搜索open_basedir,将其修改为:
open_basedir = 'c:/wwwroot;c:/wwwroot/thinkphp'
其中c:/wwwroot为网站根目录,c:/wwwroot/thinkphp为ThinkPHP框架的路径。
方法二:修改Apache的httpd.conf配置文件
打开apache配置文件夹,找到httpd.conf,在它的最后增加如下配置:
php_admin_value open_basedir 'D:wampwww;D:wampwww hinkphp'登录后复制
注:必须将php_admin_value open_basedir配置项定义在Directory节点内。
完成上述操作,重启Apache,问题就解决了。
程序执行的时候提示告警
这是因为程序没有找到index.php文件。我们需要将test.php文件中的require语句中的路径设置为index.php文件的路径,如下:
require_once('D:/wamp/www/thinkphp/index.php');
其中D:/wamp/www为网站根目录,D:/wamp/www/thinkphp为ThinkPHP框架的路径。
程序执行的时候提示错误
这是由于PHP没有安装PDO扩展造成的。我们需要在php.ini中找到extension=php_pdo_mysql.dll这行,去掉前面的';',保存php.ini配置文件。然后从php.ini中搜索extension_dir,确认这个目录下是否有php_pdo_mysql.dll文件,如果没有的话,需要下载并安装PDO扩展(如php_pdo_mysql.dll)。以上就是如何解决安装thinkphp报错问题的详细内容,更多请关注php中文网其它相关文章!
RichardGlymn3 天前
发表在:Java webservice多个参数怎么调用https://t.me/win_1_c...
Thomasstolo5 天前
发表在:Java webservice多个参数怎么调用https://t.me/s/Casin...
Thomasstolo5 天前
发表在:Java webservice多个参数怎么调用https://t.me/s/Offic...
Thomasstolo5 天前
发表在:Java webservice多个参数怎么调用https://t.me/s/Offic...
Thomasstolo6 天前
发表在:Java webservice多个参数怎么调用https://t.me/s/Offic...
Charlesbeise8 天前
发表在:10日02日,星期四,在这里每天60秒读懂世界!Get free Blockchain ...
WalterSnula21 天前
发表在:Java webservice多个参数怎么调用https://t.me/s/Reyti...
WalterSnula21 天前
发表在:Java webservice多个参数怎么调用https://t.me/s/Reyti...
WalterSnula22 天前
发表在:Java webservice多个参数怎么调用https://t.me/s/Reyti...
WalterSnula22 天前
发表在:Java webservice多个参数怎么调用https://t.me/s/Reyti...