Laravel missing composer.json - laravel

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.

Related

Run an app from a subfolder in the public folder of a Laravel app

I need to install a custom app in a subfolder of my site, and make that publicly accessible. Like mysite.com/results, where inside the results folder will be a custom JS app responsible for displaying results of some running / cycling events.
Update
By custom JS app I mean a bunch of files that comes from the race timing software I use, so I have no control of the files there, just need to be able to make them accessible.
If I create an index.html in that folder, it works, but if I create an index.php it does not work.
I use Valet on my dev machine and my website is being deployed with Ploi deploy.

Configuring Laravel project in DirectAdmin server

I'm a newbie to Laravel projects but I need to have one accessible over the internet so I tried using DirectAdmin but whenever I go to my domain I get an index (pictures attached).
I renamed the Laravel 'public' folder to 'public_html', is that correct? Here is my file structure.
Here is what I get when I go to my assigned domain which isn't my website at all.
The webpage should look something like this
I also found a laravel app using Softaculous linked here (https://panel.freehosting.com:2222/CMD_PLUGINS/softaculous/index.raw?act=software&soft=419). Am I required to use this app?
At first, you need to learn about the laravel directory structure. You don't need to change the laravel public folder to public_html. I am not sure how the DirectAdmin server works. but if you see a laravel directory instead of serving an application it's might be a path-related issue in your server. your domain should serve your application public folder.
I just found a tutorial for the DirectAdmin server with laravel. that might help.

Laravel, Using a cPanel shared hosting if possible?

I have a shared hosting with bluehost.com... can I just put my project on that.. like upload public files to public_html and others to root directory and backup MySQL DB and upload it to my shared hosting then edit my .env file... will this actually work with Laravel?
I searched most online resources and it requires ssh access to deploy, but the way I explained should not require that right?
I mean this way you don't have to go throw terminal access right?
I used to do that with WordPress when I want to set everything locally then upload it and edit URLs from the dashboard and stuff...
Yes it would work.
But you have to ensure one thing that, in your cpanel your domain point to the /public folder of laravel project.
Normally cPanel points the http requests to public_html folder, but laravel start from its public folder. You can achieve this by two way.
By pointing your server to straight to public folder
Copying the index.php to the public_html, in that case you have to edit index.php to run the laravel project properly. And I don't recommend this step. Step 1 is lot more easier.

Change Laravel Web Tinker Public Files Directory - Prevent 403 Error on Saving

I love this little library - so helpful.
However, it places some of its css and js files in a vendor folder inside the public directory of Laravel. I've got a Vendor class and paths in several apps and so, when saving a new Vendor, it redirects 403 Forbidden due to the conflicted vendor folder in the public directory.
I can't go back and refactor just for this to work, much as I like it.
It comes with a publishable config file, but I don't see an option to change the path to these files to a location outside the vendor folder. I don't want to make changes to the Spatie files, as this would just be overwritten upon next update.
Am I missing something easy here? Any way to get around this?
There isn't currently a config setting that allows you to control this.
The line causing you grief is here - https://github.com/spatie/laravel-web-tinker/blob/master/src/WebTinkerServiceProvider.php#L29. It publishes the compiled assets, as you say, into the public/vendor folder.
If you do not want to refactor your existing work, you can:
PR/fork a change to add this as a config setting
Manually change it on your end (although this could easily break if you republsihed the assets ever

laravel 5 showing directory structure in vps

I have installed Laravel 5 in my vps form the instruction given in the "http://laravel.com/docs/5.1" link. It installed successfully but when I go to http://myipaddress/laravel it showing me the directory structure. I had check my php.ini file also for the "mod_rewrite" and it is showing in the loaded package, so where I am going wrong.
Access the public folder. That's where all your output content goes. http://myipaddress/laraval/public/
Edit:
One other thing. Don't name your project "laravel" as it may cause naming problems. Try to create a new project with a different name.

Resources