dump-autoload command from php

岁酱吖の 提交于 2019-12-06 09:19:51

Well to work this out you can do this:

exec("composer dump-autoload -d /path/to/laravel-project/");

You have to explicitly tell composer where to look for composer.json.

-d If specified use the given directory as working directory

Without -d option, composer assumes your composer.json lives in path/to/laravel-project/public/. Because all requests are routed to front controller index.php and by that mean the current working directory is public/

There isn't really enough information here to help us help you.

Things to consider:

  • just want to mention the horrible security implications
  • I'm not going to address path issues, just be sure they're complete and absolute
  • my off-the-cuff guess would be that the user running php doesn't have sufficient privileges to perform the operation or write to the required directories
  • don't forget to actually 'require' or 'include' the class after you compile it
  • make sure that your autoloader is actually firing, maybe with some logging or the like
  • make sure you don't have php safe mode enabled, and that you move the uploaded file before doing any work on it

Try updating your question with some additional information if you can please.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!