search
HomePHP FrameworkThinkPHPHow to solve the error when installing thinkphp

1. Error message

When installing ThinkPHP, the following error message often appears:

  1. Unable Open compressed files (open_basedir restrictions)

  2. When the program is executed, a warning is prompted:

Warning: require(D:\wamp\www\thinkphp \index.php): failed to open stream: No such file or directory in D:\wamp\www\thinkphp\test.php on line 2
  1. An error message appears when the program is executed :

Fatal error: Class 'PDO' not found in /path/to/thinkphp/ThinkPHP/Library/Think/Db/Driver.class.php on line 34

2. Solution

  1. Unable to open compressed file

This is caused by the system’s open_basedir limitation. We were unable to decompress the file because system functions in PHP were turned off for security reasons. We can solve this problem in the following two ways.

Method 1: Modify the php.ini configuration file

Open the apache configuration folder (for example: D:\wamp\bin\apache\Apache2.2.21\conf) , find php.ini, search for open_basedir in php.ini, and modify it to:

open_basedir = "c:/wwwroot;c:/wwwroot/thinkphp"

where c:/ wwwroot is the root directory of the website, and c:/wwwroot/thinkphp is the path of the ThinkPHP framework.

Method 2: Modify Apache’s httpd.conf configuration file

Open the apache configuration folder, find httpd.conf, and add the following configuration at the end:

php_admin_value open_basedir "D:\wamp\www;D:\wamp\www\thinkphp"

Note: The php_admin_value open_basedir configuration item must be defined in the Directory node.

Complete the above operations, restart Apache, and the problem will be solved.

  1. An alarm is prompted when the program is executed

This is because the program did not find the index.php file. We need to set the path in the require statement in the test.php file to the path of the index.php file, as follows:

require_once('D:/wamp/www/thinkphp/index.php');

D:/wamp/www is the root directory of the website, and D:/wamp/www/thinkphp is the path of the ThinkPHP framework.

  1. When the program is executed, an error is prompted

This is caused by PHP not having the PDO extension installed. We need to find the line extension=php_pdo_mysql.dll in php.ini, remove the ";" in front, and save the php.ini configuration file. Then search extension_dir from php.ini and confirm whether there is a php_pdo_mysql.dll file in this directory. If not, you need to download and install the PDO extension (such as php_pdo_mysql.dll).

The above is the detailed content of How to solve the error when installing thinkphp. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool