Laravel 5.7 Nova - The Mix manifest does not exist (on server) - php

I set up laravel Nova locally last night, tested it, used it, everything works great on my local machine.
Uploaded it to the server, and everything works great except when i head to /nova which rightfully redirects me to /nova/login but then presents me with this error
The Mix manifest does not exist. (View: /home/loanappboi/nova/resources/views/auth/layout.blade.php)
i'm using shared hosting, and i uploaded the files to the root, and uploaded the public folder content, into public_html (i did the necessary file updates to reflect this change)
What could be the cause of this?
i need help

I got this same error. Running php artisan nova:publish fixed it for me. You need to have the nova resources generated.

mix() helper function use /public/manifest-json.js
Set it in config
mix.setPublicPath('public_html/')
OR
use link to public
ln -s ./public ./public_html
For Apache Options FollowSymLinks

Make sure that you are adding '/vendor' in your .gitignore and not 'vendor'. Adding just 'vendor' will ignore all folders named vendor in your codebase and nova resources are in the vendor folder in public folder.

Related

Redirect to public/ in php artisan serve

I have a laravel application that I made changes to the folder structure, I have been working with laragon and everything works fine but on my local environment and live server.
However, when i user php artisan serve, the generated url doesn't load assets in the public folder.
E.g
https://livewebsite.com // [live server] works.
https://myproject.local // [laragon] works.
http://localhost/myproject // [laragon /xampp] works
http://127.0.0.1:8000 // artisan [doesn't load assets, assets in the public directory returns 404
//e.g http://127.0.0.1:8000/public/assets/themes/cryptic/style/bgs.css would return 404
Changes I made,
|-core
|-public
|-.htaccess
|-index.php
I have moved all laravel core folders and files to the core folder,
moved the .htaccess and index.php to the root directory.
From my debugging so far, I understand that laravel built in server redirects requests to the public folder where the index.php file is located.
What changes can I make so that the request is not sent to the public folder,
i.e http://127.0.0.1:8000/public/assets/themes/cryptic/style/bgs.css should just be allowed to be without be redirected.
The entire thing works on various environments except when I'm using laravel built-in PHP server with the artisan command.
EDIT
Folder structure
|-project
|-core
|-app
|-bootstrap
|-config
|-database
|-lang
|-etc
|-public
|-assets
|-test-folder
|-img.png
|-.htacess
|-index.php
in this setup, laravel base_path() is project/core . This where all laravel core files and folders are stored.
Now I have folder test-folder with an image img.png . If i go to http://localhost/project/new-folder/img.png it will return the image but if i go http://127.0.0.1:8000/new-folder/img.png will return 404. If i use a live server and go http://livewebsite.com/new-folder/img.png , it loads.
I can't comment due to reputation, but what you're doing might be unsafe!
This way all your project files will be public, which can expose credentials and exposes Composer packages to the public as well. This means any PHP file in any Composer package can be executed, which can lead to remote code execution, which has happened before here and is described here.

How to upload laravel 5.5 project to cpanel in addon domain

This is Bablu Ahmed. I want to upload my laravel 5.5 project into cpanel and my domain is an addon domain name is w3public.com and it's root directory is not inside the public_html it is outside the public_html (www.w3public.com). I have separated the project's files into two directories, one is www.w3public.com and another is laravel and I moved public folder's files into www.w3public.com and all other files into the laravel folder in cpanel that is given in screenshot below. I have also modified the index.php file of www.w3public.com as follows:
require __DIR__.'/../../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../../laravel/bootstrap/app.php';
But it is not working. Can anyone help me with appropriate solutions?
Screenshot:
Your application should be installed in www.w3public.com and then change the root path from cpanel domains to the public folder inside laravel.
The best way to transfer files is git or the likes, but if they don't have it (usually is the case in shared hosting), you should use a ftp client, and if they don't allow that either, you can upload files/folders from cpanel (way too slow sadly).
If you use git be careful since by default vendor folder is in the .gitignore (you have to run "composer update --no-dev" after all the files are transferred)
Make sure also that your ".env" (usually in .gitignore too, so you prob have to make one) file have your server database info.

HTTP 500 Error in Symfony 3

I created an app on my localhost using symfony 3. Stuff works perfectly well on my local host. Now my main problem is moving it to my shared hosting (cPanel). Moved the files to the public_html folder, then I moved the .exe, bin, src, var, etc folders to the parent folder (The folder containing the public_html folder) while leaving the 'web' folder in the public_html. I then moved everything from the 'web' folder (Which is inside the public_html folder) into the public_html folder. Making me have the following directory structure:
cpanel-root-directory<br>
---/app<br>
---/bin<br>
---/src<br>
---/tests<br>
---/var<br>
---/vendor<br>
---/public_html<br>
------/bundles<br>
------/css<br>
------/dist<br>
------/fonts<br>
------/img<br>
------/js<br>
------/plugins<br>
------/uploads<br>
------.htaccess<br>
------app.php<br>
------app_dev.php<br>
------apple-touch-icon.png<br>
------config.php<br>
------robots.txt<br>
<br>
When I go to the domain name, I keep getting this annoying HTTP 500 error. Then on both localhost and on the server (at different times), I created a fresh new symfony project, dumped it in the server and got the "Welcome to Symfony 3" page quite alright. But, when I tried putting my controller files, and going to the routes defined in them (I use annotations in the Sensio bundle to define routes), I get that HTTP 500 error. Then, in the default controller that works, I try defining a new action 'testAction'. When I go to the route for the test action, I still get the HTTP 500 error, but going to the '/' route, I see the symfony welcome page correctly.
My clients have seen that the stuff works perfectly well on my localhost, but now moving it to the server is the issue.
If you can (have access), just keep your web dir, and then make public_html a symlink to your web dir.
If you need to change the name of your "web" dir, you need to follow this instructions:
http://symfony.com/doc/current/configuration/override_dir_structure.html
You should check this paragraph from Symfony documentation
This part seems to describe exactly your problem:
Some shared hosts have a public_html web directory root. Renaming your web directory from web to public_html is one way to make your Symfony project work on your shared host. Another way is to deploy your application to a directory outside of your web root, delete your public_html directory, and then replace it with a symbolic link to the web in your project.
Eh, I think that's because, now, you are online, so you need to clear the cache for the prod environment:
$ php bin/console cache:clear --env=prod
But you say you are on a shared hosting, so unless you have some available tools to access the terminal (and run the above command), then you need to manually delete the var/cache/prod directory if present.
Or if this doesn't work, I usually, don't upload the var/cache + var/logs + var/sessions directories at all, but create them manually as empty ones, and then let Symfony do its job with them by default.
LE
Maybe you have another problem, and the one with the cache you've solve it already.
So, to check if there is something wrong with your app, enable the dev mode ( app_dev.php ), by modifying, locally, your public_html/app_dev.php file, and comment out these lines:
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(#$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) || php_sapi_name() === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
And then, copy this file over the one on the server, and then access a route with app_dev.php in front, and see if there is an error (eg):
http://www.domain.com/app_dev.php/existing_route
After you are done, don't forget to uncomment the code inside app_dev.php,and re-upload the file on the server.

How to put laravel 5.3 project on shared hosting

I made a laravel project on my localserver. I just copy the project folder and pasted on my web server in public_html folder. It's giving an error when i open it.
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Can anyone please let me know step by step how to put my laravel project on web serve?
Well there are three ways to upload and make workable on shared hosting which I came to know.
Rename server.php file to index.php (which is not the correct way)
Shift public/* to root (also, its not the correct way)
Need to add a line in public/index.php after initialization of $app
$app->bind('path.public', function() {
return _DIR_;
});
and that's proper way as per my knowledge.
(My last answer was deleted before I could submit my edits, so here's another, more complete answer)
There is an easy answer, and a long answer.
Long answer
The most important part to know is that the only part of Laravel that should be accessible to the public is in the public folder. Which means that, on your shared host, the content of public should reside in whatever folder is the public on your host (they usually are named "www", or "public_html", but it can be anything, really).
I'm going to assume here that you have only one project on your account and say that, if it's the case, you now only need to upload every other file and folder at the same level as the public folder you have and set the correct permission to the storage folder.
In the end, if the only thing you do is upload all of your project to the root folder of your account, then rename Laravel's public folder to public_html, this is supposed to work (of course, assuming that you can also use the CLI and call artisan and composer commands).
Easy answer
If you can use the command line and create synlinks on your host, you can simplify your life by uploading all of your project into a folder outside of the public_html folder and symlink public to your public_html like so: ln -s /full/path1/project/public /full/path/to/public_html
Detailed answer and more tips
You can read this article that goes into more detail and gives commands to achieve everything. I tried to keep my answer as concise as possible, so if you want a more step by step approach, this link or a bit of google searching will do the trick!

Laravel 4 - class not found on live server

I'm uploading my laravel 4 app to a testing server which is shared hosting.
I'm uploading to a password protected directory which has a .htaccess file within it. My subdomain points to the public folder.
For the most part they app is working as expected I can log in, view most of the pages however every class that I have created such as a helper class and additional controllers are not being found on the live server yet all works on my local environment.
I've redone a composer dump-autoload and uploaded the composer.json file
I'm not sure where to start with this.
In my upload I've included all the files and folders to the live server (twice now). I read somewhere else I should namespace my classes but why would this help if the main laravel controllers do not namespace?
Confused - all help appreciated
When you do a composer update, if Composer finds anything new it will update some files in the folder
vendor/composer
Like the file autoload_classmap.php.
So, you have to reupload at least this folder too.
Maybe it's about git, you are pushing changings with some certain case sensitive Folders and Files, but git is changing this therefore it will work on Mac and Windows OSs but not on the server.
just use this command:
git config core.ignorecase false
above command for the current repository and you may add --global just after config keyword.
please note that ignorecase option available since version 1.5.6 and I assume you are running 2.0.x but just mentioning!

Categories