[已解决]Thinkphp Error: Failed to open stream: No such file or directory vendor/autoload.php

当第一次尝试着去运行thinkphp时,你或许会得到下面的错误。

Warning: require(/var/www/html/tp/public/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/tp/public/index.php on line 15

Fatal error: require(): Failed opening required ‘/var/www/html/tp/public/../vendor/autoload.php‘ (include_path=‘.:/usr/share/php‘) in /var/www/html/tp/public/index.php on line 15

问题场景: 

这个问题一般发生在你从github上下载(download)或者克隆(clone) thinkphp的时候,我们将得到的thinkphp放入web服务器,然后通过浏览器去访问它(http://localhost/tp5/public)。

原因:

尽管你已经下载了Thinkphp框架代码并且把他放入到你的web服务器上,但是这里仍然缺少了依赖性。为了能够让Thinkphp正常运行,应该安装这些缺少的依赖。

解决:

为了解决这个错误,你需要使用composer去安装缺少的依赖。Composer是PHP的一个依赖性包管理工具。如果你的系统中还没有安装composer,你需要第一时间安装它。你可以去官网下载composer: https://getcomposer.org.

如果你是Linux系统,你可以通过终端去安装

sudo apt install composer

一旦在你的系统上安装了composer,然后你需要按以下步骤去安装缺少的依赖性:

-打开终端或者命令提示符

-进入你的Thinkphp目录

-例如,默认情况下Ubuntu Linux的web root是/var/www//html;在Windos中,如果你把wamp安装在D盘下,那么你的web root将是D:/wamp/www

-假设,你下载、复制了Thinkphp文件到名为tp的目录下

-然后,在Linux下的web服务器中,你的tp目录将会是/var/www/html/tp

-你可以在终端通过以下命令进入到tp目录: cd /var/www/html/tp

-运行下面的命令

composer install

-这将会安装运行Thinkphp所需的依赖。安装所有的依赖可能需要一些时间。

现在你应该能够正常地访问Thinkphp了,不会有任何的错误。

http://localhost/tp/public

如果你已经运行了composer install命令却仍然得到错误,那么你应该运行下面的命令:

composer update

或者说,创建thinkphp project和安装thinkphp的最好的方式就是直接使用composer。你可以在终端或者命令行提示符中运行下面的composer命令:

-进入你的web服务器root( 在Linux中是/var/www/html )

-在终端运行下面的命令:

composer create-project topthink/think name-of-your-project

-这将会创建一个name-of-your-project目录并在目录中安装Thinkphp文件。

-这还将安装所有必须的依赖以运行Thinkphp

-然后,你可以在浏览器中输入: htpp://localhost/name-of-your-project/public 去访问Thinkphp

Hope this helps. Thanks.

参考、翻译自 : https://blog.chapagain.com.np/solved-laravel-error-failed-to-open-stream-no-such-file-or-directory-bootstrapautoload-php/

原文地址:https://www.cnblogs.com/wgxi/p/11746359.html

时间: 2024-08-28 20:09:05

[已解决]Thinkphp Error: Failed to open stream: No such file or directory vendor/autoload.php的相关文章

Laravel5.6安裝:Warning: require(../vendor/autoload.php): failed to open stream: No such file or directory

在phpstudy下使用composer+laravel安装器的方式安装了Laravel,但是访问的时候报错: Warning: require(D:\phpstudy\WWW\public\myblog\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in .../autoload.php on line 17 通过百度了解到在项目根目录运行composer update命令

Laravel访问出错错误信息:`Warning: require(/vendor/autoload.php): failed to open stream: No such file or dire

错误信息:`Warning: require(/http/www.mywakavLee.cn/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /http/www.mywakavLee.cn/bootstrap/autoload.php on line 17 Fatal error: require(): Failed opening required '/http/www

Mac OSX Yosemite 10.10 brew 错误:mktemp: mkdtemp failed on /tmp/git-LIPo: No such file or directory

这个问题困扰了我很久很久,使得我不得不花一点时间来说一下解决方法. 事情是这样的:前两天兴高采烈的更新了一下宝贝mac到10.10.一切看起来都那么美好,但是..当我重新安装magento的时候发现需要mcrypt!:之前有装过,但是更新了一下就没有了,好吧,重装!!但是这个时候发现,brew update不能用了!!坑屌丝么!!so重装brew!,好不容易装好了,brew install mcrypt的时候,遇到问题: Already downloaded: /Library/Caches/H

Eclipse解决Launch error: Failed to connect to remote VM [duplicate]

有时开启多个Eclipse之后,连接真机调试程序时在Controls控制台里面会出现Launch error: Failed to connect to remote VM [duplicate] ,DDMS输出里面会报con't bind to local 86XX 或者87xx debugger的错误,这是因为端口占用的问题 解决方案: 1.关闭eclipse 2.拔掉Usb连接线 3.关闭任务管理器中所有的Eclipse.exe进程 4.关闭adb.exe 5.重启eclipse,重新连上

【错误解决】BeanDefinitionStoreException: Failed to read candidate component class: file [mapper.class文件]; nested exception is java.lang.IllegalArgumentException

问题描述: "spring-mybatis整合,使用mapper代理开发,通过MapperScannerConfigurer进行mapper扫描"的练习中,出现异常: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [E:\项目\mybatis_spring\bin\cn\itheima\ssm\mapper\Us

在安装mysqli的时候,出现error: ext/mysqlnd/mysql_float_to_double.h: No such file or directory

/application/php5.5.28/include/php/main/../main/php_config.h:2113:1: warning: this is the location of the previous definition/home/neo/tools/php-5.5.28/ext/mysqli/mysqli_api.c:36:47: error: ext/mysqlnd/mysql_float_to_double.h: No such file or directo

git报错remote: error: cannot run hooks/post-receive: No such file or directory

错误情况如下图所示: 如果你也显示这个错误但是其实在该路径上有上有这个文件,那么显然你遇到和我一样的情况,即你是Windows下创建的文件,但是试图在Lunix系统去打开它.这是在Windows下调用CentOS上文件显示的结果,如果你还有疑虑可以尝试在CentOS直接打开该文件,那么你将会遇到下面的错误: -bash: hooks/post-receive: /bin/bash^M: bad interpreter: No such file or directory 因为各个操作系统的文件对

PHP中调用move_uploaded_file函数提示failed to open stream和 Unable to move

在做一个PHP文件上传系统的时候,使用move_uploaded_file进行文件上传,提示下面两个warning,不能成功上传文件 Warning: move_uploaded_file(upload/songshu_rgb.gif) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\www\2737\upload_file.phpon line 25 Warning: m

Laravel的Warning: require..../vendor/autoload.php错误的解决办法

Warning: require(D:\www\laravel-canvas\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in D:\www\laravel-canvas\bootstrap\autoload.php on line 17 Fatal error: require(): Failed opening required 'D:\www\laravel-canv