Thinkphp is deployed in the CVM, and the access prompt indicates that the Index module does not exist.

problem description

thinkphp is deployed in the CVM, and access prompts that the Index module does not exist. And the routing access result defined in router.php is 404.

the environmental background of the problems and what methods you have tried

the environment is a Baidu cloud virtual host. Try to move the index.php and .htaccess in the public folder in the thinkphp framework to the root directory, and modify the index.php code.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
define ("APP_PATH", DIR . "/.. / application/");
require DIR . "/.. / thinkphp/start.php";

what result do you expect? What is the error message actually seen?

the actual error of expecting to call Api, under application is 404.

Jan.27,2022

is your host's web working directory set to the same directory as the TP framework's entry files? Look at your description like the problem caused by not finding the entry file in the web working directory


Why not set the root directory to the public/ directory?
since index.php has been moved to the parent directory, you APP_PATH should be _ _ DIR__. '/ application/' is correct, and so is the path to the corresponding start.php file.

Menu