Laravel project structure on server - laravel

I just bought a domain name for my website and linked it to my server. But now that I have transferred the files of my old free domain to my new one, I can't figure out why it redirects me to my old site and why I get the green page saying `Laravel is installed successfully.
Laravel is a Framework and doesn't have an index page.
You will be redirected to its "public" folder in 5 seconds... bla bla bla
I need some help!!
Here's the structure of my files on the server:
EDIT:
The "shlproextra" directory was too much in my directory structure. I just extract all the dir from it and put them in htdocs like this:
|shlproextra.ca
|----htdocs
|----app
|----bootstrap
|----cache
|----config
|----...

All files should be at shlproextra.ca/, /shlproextra/ not needed
On /server.php you chance line:
require_once DIR.'/public/index.php';
to
require_once DIR.'/htdocs/index.php';

Check APP_URL value in .env file.

Related

How to deploy laravel project on ovh hosting?

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

Could not find Maintenance.flag file in root folder magento

I was trying to install an extension in my magento site which was failed in the middle later i could not get access to my admin neither to my site as it shows this error.
http://prntscr.com/68qc3c
this error should be removed maintenance.flag file but this file is not available in my root folder. Please assist me if there is any other way possible?
Thanks
two possible ways are
1 . you can delete manually both session and cache directory from var directory.
path
magento_root/var/
2. or you can delete all files of that extension and reinstall again.
The maintenance.flag file must still be in your root directory, otherwise Magento would not be displaying the 503 error. The way that this is displayed is a result of the index.php file, around line 66:
$maintenanceFile = 'maintenance.flag';
if (file_exists($maintenanceFile)) {
include_once dirname(__FILE__) . '/errors/503.php';
exit;
}
This page cannot even be cached. Re-connect to your FTP server and check for the file in your html directory on the webserver. Alternately, speak with your web hosts & have them remove the file.
As a precaution, you can try deleting your var/cache directory and see if that makes a difference.

How to install or move laravel project on web server

I'm having trouble installing/moving laravel to web server, i downloaded and set laravel on my local linux server but when i moved it to web server ,it shows a blank page.
I uploaded the public folder contents to public_html and other contents outside the public, also i changed the public DIR from paths.php on bootstrap folder as follow: 'public' => __DIR__.'/../public_html/' so what is the exact problem? Please help me with this issue. Is composer a problem? or what?
1) Create a new directory called ‘laravel4′ adjacent to ‘public_html’ so that your remote file structure now looks like this:
[.htpasswds]
[etc]
[laravel4]
[mail]
[public_ftp]
[public_html] etc etc varies depending on server
2) Upload the contents of your local ‘public’ directory to the remote directory ‘public_html’. Note: Be sure not to copy the whole ‘public’ directory, JUST it’s contents.
3) Upload everything else within your local Laravel project to the new remote ‘laravel4′ directory. Check: Now when you view the ‘laravel4′ folder over FTP/SSH/Whatever, you should see all your ‘app’ & ‘bootstrap’ directories along with all the other files and directories, but NOT ‘public’.
4) Edit the remote file ‘public_html/index.php’ and make the following change:
//from:
require __DIR__.'/../bootstrap/autoload.php';
//and
$app = require_once __DIR__.'/../bootstrap/start.php';
//to:
require __DIR__.'/../laravel4/bootstrap/autoload.php';
//and
$app = require_once __DIR__.'/../laravel4/bootstrap/start.php';
5) Edit the remote file ‘laravel4/bootstrap/paths.php’ and make the following change:
//from:
'public' => __DIR__.'/../public',
//to:
'public' => __DIR__.'/../../public_html',
6) That should be it. In my case, that was enough to restructure everything. Routes are working with the default .htaccess file. If you have problems, let me know, or ask on the ever-helpful
Reference: http://myquickfix.co.uk/2013/08/hosting-laravel-4-on-cpanel-type-hosting-public_html/

Uploading Laravel Project onto Web Server

I am trying to upload my Laravel project onto my web server, but my past two attempts have been unsuccessful. I believe I am not uploading the files to the right location.
This is my web server's structure ->
Am I correct to say that I need to upload ALL of my laravel files into public_html?
This is my Laravel project's directory :
EDIT : I have now added all the files onto the root folder, and public into public_html, however none of my routes seem to work. (They work perfectly on localhost). Everything throws a 404
No, but you have a couple of options:
The easiest is to upload all the files you have into that directory you're in (i.e. the cPanel user home directory), and put the contents of public into public_html. That way your directory structure will be something like this (slightly messy but it works):
/
.composer/
.cpanel/
...
app/ <- your laravel app directory
etc/
bootstrap/ <- your laravel bootstrap directory
mail/
public_html/ <- your laravel public directory
vendor/
artisan <- your project's root files
You may also need to edit bootstrap/paths.php to point at the correct public directory.
The other solution, if you don't like having all these files in that 'root' directory would be to put them in their own directory (maybe 'laravel') that's still in the root directory and then edit the paths to work correctly. You'll still need to put the contents of public in public_html, though, and this time edit your public_html/index.php to correctly bootstrap the application. Your folder structure will be a lot tidier this way (though there could be some headaches with paths due to messing with the framework's designed structure more):
/
.composer/
.cpanel/
...
etc/
laravel/ <- a directory containing all your project files except public
app/
bootstrap/
vendor/
artisan
mail/
public_html/ <- your laravel public directory
I believe - your Laravel files/folders should not be placed in root directory.
e.g. If your domain is pointed to public_html directory then all content should placed in that directory. How ? let me tell you
Copy all files and folders ( including public folder ) in public_html
Copy all content of public folder and paste it in document root ( i.e. public_html )
Remove the public folder
Open your bootstrap/paths.php and then changed 'public' => __DIR__.'/../public', into 'public' => __DIR__.'/..',
and finally in index.php,
Change
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';
into
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/start.php';
Your Laravel application should work now.
If you are trying to host your Laravel app on a shared hosting, this may help you.
Hosting Laravel on shared hosting #1
Hosting Laravel on shared hosting #2
If you want PHP 5.4 add this line to your .htaccess file or call your hosting provider.
AddType application/x-httpd-php54 .php
In Laravel 5.x there is no paths.php
so you should edit public/index.php and change this lines in order to to pint to your bootstrap directory:
require __DIR__.’/../bootstrap/autoload.php’;
$app = require_once __DIR__.’/../bootstrap/app.php’;
for more information you can read this article.
Had this problem too and found out that the easiest way is to point your domain to the public folder and leave everything else the way they are.
PLEASE ENSURE TO USE THE RIGHT VERSION OF PHP. Save yourself some stress :)
All of your Laravel files should be in one location.
Laravel is exposing its public folder to server. That folder represents some kind of front-controller to whole application. Depending on you server configuration, you have to point your server path to that folder. As I can see there is www site on your picture. www is default root directory on Unix/Linux machines.
It is best to take a look inside you server configuration and search for root directory location. As you can see, Laravel has already file called .htaccess, with some ready Apache configuration.

Installing a CodeIgniter application in a subfolder

I'm trying to install an application made with codeIgniter in a subfolder, so that I can access it using : http://www.domain.com/my_subfolder/
At the root, there's a Wordpress application.
I edited the .htaccess of the Wordpress install to let the request go to the folder /my_subfolder/
It's working fine, the only problem I get is that CodeIgniter is unable to dynamically load the classes in the "libraries" directory. So everything in the CI application works fine until it tries to use an object declared in the "libraries" subfolder, then I get a : Unable to load the requested class: my_class
It doesn't seems that there's a parameter in the "config" folder to change that... any idea?
What you need is to edit your CodeIgniter config.php in System > application > config.
and then edit config.php and set the property:
$config['base_url'] = "http://www.domain.com/my_subfolder/"
Well it seems that the config param base_url should be updated. Also, I used a library with the "MY_" prefix, and I should'nt since I was'nt extending any CI class.
This is 2021. In case anyone is having this same issue with CodeIgniter 4, this is how I solved it when I came across this issue.
Problem
I installed CI in a subfolder in my public_html folder i.e example.com/api. When I visited www.example.com/api, I saw a 403 forbidden error.
Solution
Download and unzip CI on your local machine or use composer.
Rename public folder to the name of your subfolder. In my case, I named it api.
Create another folder and give it any name of choice, for example, let's use mango (yes, I love mangoes). Copy all the remaining files and folders (app, system, writables, env, LICENSE, README, composer, phpunit, spark) into the mango folder. After doing this, we should have 2 folders: api and mango
Copy both folders to your live server cpanel root (Do not copy into public_html or www). Let them be on the same level as public_html
Open api/index.php and change $pathsConfig = FCPATH . '../app/Config/Paths.php'; to $pathsConfig = FCPATH . '../mango/app/Config/Paths.php';
Create a subdomain and point it to /api
Go to the api folder, duplicate the env file and rename it to .env
Open .env and look for app.baseURL=''. Remove the '#' to uncomment that line and the change it to app.baseUrl='http://subdomain' where subdomain is the subdomain you created above e.g http://api.example.com
Open mango/app/config/App.php and look for public $baseUrl and set it to subdomain e.g $baseUrl = 'http://api.example.com'
Your CI project is now well configured. Visit http://api.example.com. and you should see the CodeIgniter welcome page.

Resources