John Davidson

php - how upload laravel folder (with view files in public folders) to server

0 comments
Message:


My laravel project has view files in public folders that are extended from resource folders.
The problem is when I upload to infinityfree server.
I upload the folder structure as follows.


htdocs -> all files in public folder .
-> laravel -> All laravel project files


so index file need to edit


if (file_exists($maintenance = __DIR__.'/laravel/storage/framework/maintenance.php')) {
require $maintenance;
}

The problem is that cannot find view files in the public folder.
server says it cannot access to view files in public folder -> themes folder



if upload all folders directly into htdocs, it says 403 error.


So how can upload this laravel app?


here is folder structure


here is directory listing after edit htacess file.


how edit to see website directly,
here is env file


APP_URL=http://learnerschool.epizy.com
APP_DEBUG=true
IS_DEMO=false




My Answer:
- laravel_project
- app
- bootstrap
- config
- database
- public
- css
- js
- images
- index.php
- resources
- routes
- storage
- tests
- vendor

To upload a Laravel project with view files in the public folder to a server, you need to follow these steps:

1. Zip the entire Laravel project folder on your local machine.
2. Access your server's file manager or use an FTP client to upload the zipped file to the desired directory on the server (e.g., htdocs).
3. Extract the zipped file on the server to create the Laravel project folder.
4. Move all the contents of the public folder to the root directory of the Laravel project folder.
5. Edit the index.php file in the public folder to point to the correct paths for the bootstrap/autoload.php and bootstrap/app.php files. Update the following lines:

php
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';


to:

php
require __DIR__.'/../laravel_project/bootstrap/autoload.php';
$app = require_once __DIR__.'/../laravel_project/bootstrap/app.php';


6. Update the paths in the index.php file to point to the correct paths for the vendor/autoload.php file. Update the following line:

php
require __DIR__.'/../vendor/autoload.php';


to:

php
require __DIR__.'/../laravel_project/vendor/autoload.php';


7. Update the paths in the index.php file to point to the correct paths for the bootstrap/app.php file. Update the following line:

php
$app = require_once __DIR__.'/../bootstrap/app.php';


to:

php
$app = require_once __DIR__.'/../laravel_project/bootstrap/app.php';


8. Save the changes to the index.php file.
9. Your Laravel project should now be accessible on the server with the view files in the public folder. You can access it by visiting the server's URL in a web browser.

Rate this post

3 of 5 based on 2680 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us