简体   繁体   中英

Laravel missing composer.json

I've pulled a client's project from FTP and web has structure as follows:

  • error_docs
  • httpdocs (where laravel files are stored)
  • logs

So I've pulled files inside httpdocs to a folder and updated the homestead.yaml and hosts file accordingly, and everything works fine, like it does on the website.

The problem I'm facing is that the folder structure is somehow different from what I'm used to on Laravel, and composer.json is missing, which as a side-effect has that I can't for example create new controllers.

[ErrorException]
file_get_contents(/home/vagrant/Code/my_project/composer.json): failed to open stream: No such file or directory

If I create one manually, I can't make a composer update or something similar, so the controller never gets registered in the project, and is as if I've never created it.

I tried running a composer init and then composer update which results in removal of all dependencies, and crashing the project.

Does anyone know how can I resolve the issue?

EDIT:

The project also has public folder empty, so I ended up mapping homestead.yaml like this:

- map: project.dev
  to: /home/vagrant/Code/my_project 

EDIT2:

Just found out it's a bought template from a web...still no update

So you basically downloaded a project from a shared hosting right?

Ask your client about source control / version control tools like Git if they use one and download the project from the repository.

Also, don't run composer update but run composer install and if you downloaded the project together with the vendor file, you shouldn't need to install the dependencies or update them.

Go to the laravel's github repository and download the default composer.json file just so you can autoload the classes and files.

The public folder is most likely empty because shared hostings use public_html as a default folder. Map everythng to it and change the code in your laravel application to point to public_html instead.

Laravel does not have support for shared hosting, but you can hack it up and make it possible only if you have composer available on that shared hosting server / console / cpanel, because some shared hostings are way too limited with it.

If you have to pay for extra support like server access, you are better off going with DigitalOcean which is a VPS and you have better server access there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM