I created a subdomain and move whole project except public folder. Create mysql database and upload my database there. Now, in public_html folder I already have wp files so I created new folder there which I named same as subdomain. So, subdomain is something.something.com and now I have path public_html/something/public where I upload all from public folder. I try to rename files in index.php public foder:
require __DIR__ . '/../bootstrap/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
to this:
require __DIR__ . '/../something/public/bootstrap/autoload.php';
$app = require_once __DIR__ . '/../something/public/bootstrap/app.php';
but still I get this:
And I edit .env file to find database. Where am I wrong?
Solved! It was PHP version mismatched. In local it was 7.1 but on server was 5. When I update on server it worked.
Related
I already installed GuzzleHttp using composer but the require 'vendor/autoload.php'; returns an error. I've tried using FCPATH . 'vendor/autoload.php'; and it returns C:\xampp\htdocs\local\public\vendor\autoload.php". I think the problem is the public folder in the url. When I tried it without the public folder it works.
Notes:
FCPATH
The path to the directory that holds the front controller.
ROOTPATH
The path to the project root directory. Just above APPPATH.
Solution:
Instead of:❌
require FCPATH . 'vendor/autoload.php';
Use this:✅
require_once ROOTPATH . 'vendor/autoload.php';
You could alternatively, use COMPOSER_PATH:✅
I.e:
require_once COMPOSER_PATH;
Composer Path
The path that Composer's autoload file is expected to
live. By default, the vendor folder is in the Root directory, but you
can customize that here.
For the last month I coded a laravel project on local, using Laragon to have a local server. Now I want to deploy it online, using an ovh hosting ( required by a client ). So I have my ovh hosting, with the "perso" offer.
I used the ftp credentials given by ovh, with FileZilla, and it worked. It gave me something like this :
Then I uploaded all my project in the www folder. Now, when go to the domain, it doesn't display the front page but rather the folder itself, aka this :
For now, I didn't touch the .env file. I deleted the default index.html in the www folder, I know the problem probably come from this. I searched everywhere and found not clear explanation. My knowledge on web hosting is limited, so I'm struggling with this. I know I missed something. Anyone who could help me, would save my life. Thank you !
do not put you project files in the www folder, instead put them in a folder outside that directory 'called laravel for example'.
then copy or move the contents of the 'public' directory to 'www'. (www dir will now contain index.php,...).
edit the two lines in www/index.php that require autoload.php and app.php to reflect the new directory changes:
require __DIR__.'/../vendor/autoload.php';
should be:
require __DIR__.'/../laravel/vendor/autoload.php';
and
$app = require_once __DIR__.'/../bootstrap/app.php';
should be:
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
The best is to create a new folder in the /www folder with the name of your project.
For exemple: /www/laravel-project
Then you will need to go OVH admin panel, click on your domain and change the folder it is going to by /www/laravel-project/public
You need to go to the public folder of your Laravel project.
saying that your project name is : Laraval_project :
using "filezilla", put 'laravel_project/' under the directory 'www/'.
find the dir named : 'public/' under 'laravel_project/' and copie/pass it in the the parent dir, wich is : 'www/'.
now u have side by side 'laravel_project/' and 'public/' under 'www/'.
in 'public/' folder u'll find four files -> move them all to the parent dir, wich is 'www/'..
edit www/index.php file as Rabah said :
edit the two lines in www/index.php that require autoload.php and
app.php to reflect the new directory changes:
require __DIR__.'/../vendor/autoload.php';
should be:
require __DIR__.'/laravel_projec/vendor/autoload.php';
and
$app = require_once __DIR__.'/../bootstrap/app.php';
should be:
$app = require_once __DIR__.'/laravel_project/bootstrap/app.php';
if ther is a file named : 'www/index.html', rename it :
'index.html.old . enjoy
I have uploaded my public items in public_html/demo
other folders to /home/danior/source/
/home/danior/public_html/demo/index.php:
require __DIR__.'/../../source/vendor/autoload.php';
$app = require_once __DIR__.'/../../source/bootstrap/app.php';
/home/danior/source/server.php:
require_once __DIR__.'/../public_html/demo/index.php';
http://danior.ir/demo/
but there some unknown errors !
filesystem.php won't upload
I upload my projects like this, hope it will help-
Create a sub-domain/domain eg- demo
Upload public folder items in your sub-domain "demo".
Create another folder inside public_html eg- demo_support.
Compress rest of the files as xyz.tar and upload and decompress in public_html/demo_support and configure your .env according to you.
Now in your public_html/demo/index.php -
replace
require __DIR__.'/../bootstrap/autoload.php';
with
require __DIR__.'/../demo_support/bootstrap/autoload.php';
and
replace
$app = require_once __DIR__.'/../bootstrap/app.php';
with
$app = require_once __DIR__.'/../demo_support/bootstrap/app.php';
I have developed a web application using Laravel 5.8, now I want to host that to a shared web server. What will be the folder structure and exact what to configure.
I have created a folder named laravel and kept all the project folders into that laravel folder, except project's public folder. I kept all the files and folders of public folder into public_html folder.
I have configured the index.php file of public_html folder as below.
a. require __DIR__.'/../bootstrap/autoload.php';
to,
require __DIR__.'/../laravel/bootstrap/autoload.php';
b. $app = require_once __DIR__.'/../bootstrap/app.php';
to,
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
$app->bind('path.public', function() {
return __DIR__;
});
*** I have solved the problem myself.
Step 1: I have found and installed laravel app into public_html folder from the cPanel
Step 2: Then I have moved everything into a folder named laravel except public folder into a new folder outside public_html folder
Step 3: Then I have moved everything from public folder into public_html folder
Step 4: Later I have followed the 2nd step above
Step 5: Then I have changed folder permission for storage folder and it works fine.
Step 6: Finally I have kept all other files and folders of the app developed in my local server into this newly installed app directories
Laravel default structure always better. its depend on your hosting place.
if your hosting place support for laravel framework then use default structure automatically public word redirect to project path.
Or if you need to ignore Public word in your Url
Copy all files form files put in to one folder ex:psl
copy public folder paste in to folder directory
change the index.php file in two place
require __DIR__.'/psl/bootstrap/autoload.php';
$app = require_once __DIR__.'/psl/bootstrap/app.php';
I had similar errors on my deploy and then I noticed that the path is kind of wrong:
require __DIR__.'/../laravel/bootstrap/autoload.php';
the leading / changes to the root of the drive, and then the .. are not doing anything. Removing that leading / on both require __DIR__ fixed it for me.
if you can not provide a link to the web root of the shared folder!
All except the Public folder to move to a higher level, such as a folder laravel - http://prntscr.com/bryvu7
(Maybe on hosting your folder - public. not a folder public_html)
Change file publi_html/index.php
line
require __DIR__.'/../bootstrap/autoload.php';
to
require __DIR__.'/../laravel/bootstrap/autoload.php';
And line
$app = require_once __DIR__.'/../bootstrap/app.php';
to
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
$app->bind('path.public', function() {
return __DIR__;
});
Change file laravel/server.php
line
require_once __DIR__.'/public/index.php';
to
require_once __DIR__.'/index.php';
hi i am using wampserver for my project
and my project is in folder sss
so i must type this Url localhost\sss\public
and want to have this
localhost\sss\
to show my index page
Copy the public folder contents outside the public folder and open index.php which you copied outside the folder, than change the:
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';
to
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/start.php';
and you can access directly.