Laravel4 Error showing /bootstrap/autoload.php on line 17 - laravel

I uploaded a new laravel 4 app and cannot figure out how to get it to work. I am not sure if it is something with the composer.json file or what.
Here is the error I am getting:
>Warning: require(/home/flemzy/public_html/l/bootstrap/../vendor/autoload.php) [function.require]: failed to open stream: No such file or directory in /home/flemzy/public_html/l/bootstrap/autoload.php on line 17
>Fatal error: require() [function.require]: Failed opening required '/home/flemzy/public_html/l/bootstrap/../vendor/autoload.php' (include_path='.:/opt/php53/lib/php') in /home/flemzy/public_html/l/bootstrap/autoload.php on line 17

Where did you upload you Laravel app ? From you path it seems it is in your home folder ? Laravel should be placed on your server, and you should point your server path to Laravel public folder. There is a default .htaccess file in every Laravel instalation, which is ready for Apache. Also, after install, you should run composer install, in order to download all dependencies. That vendor/autoload.php file is a part of core framework, so that means that you didn't install all dependencies properly.

I have had similar messages / problems uploading laravel to a server subdirectory.
Laravel docs provide an alternate .htaccess file that fixed my problems.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Copy / paste that into your .htaccess, replacing the old one. Laravel Docs
To use the command line if it's a composer issue, you can use SSH to access your laravel directory. If you're using windows you can use PuTTY for that, which has lots of tutorials and instructions online.
Laravel SSH docs

Related

Deploy Laravel app on shared hosting properly?

What am I doing
Open FTP -> public_html -> laravel folder.
Copy all files from local directory to laravel folder
Open URL of the site and get this on the screen
https://i.stack.imgur.com/IbsvQ.png
Problem is simple, it opens directory, and not lead to index.php in public/ directory.
I tried everything I found in Google, like:
Move .htaccess file from /public to laravel directory and change it, like this:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
It works, but not completely, it load site, but it doesn't load .css and .js (static files) from public directory, which is normally, after I moved out .htaccess files, so I should change asset() everywhere in the project and add "public/", which doesn't look OK for me.
Instead of moving .htaccess I tried to edit index.php file, like most of the tutorials show:
require __DIR__.'/../vendor/autoload.php';
to
require __DIR__.'/../laravel/vendor/autoload.php';
and
$app = require_once __DIR__.'/../bootstrap/app.php';
to
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
It doesn't work.
Is there a way to handle this, without edit asset() everywhere in my project ?
Option 1
The best way to deploy, if you do not have access to the ssh but the ftp is:
Copy and paste the project on the parent folder of public_html
Wait for the upload, I recommend you to separate in an appropiate mode your dependencies in order to no install devDependencies in your prod site (this also applies for your JS assets).
once the entire laravel site is uplodaded, then you should have to delete the public_html folder and then from public make a symlink this will create a reference from your public folder and apache will try to access to the reference associated with the new public_html symlink.
Option 2
If you have access to your server through SSH, then I strongly recommend you to check if you have git available on your server, then you would be able to pull your master branch (this should be prepared for production). And also create the symlink using command line.
Also if you have SSH you will be able to prepare your project as it should with the commands you need to make it work.
I think the best way to deploy on shared hosting is to create a project folder outside the public_html folder
And add all you project files there
Then move all the files in project public folder to public_html with laravel default htacess file
Now open the index.php file you have moved to public_html
And define a proper path to project director outside the public_html directory example
require __DIR__.'/../your_project/vendor/autoload.php';
Change all path like this.... I hope its helps you

Is there any way to remove this public from the URL?

I am using laragon server for php 7.2 laravel. I have tried a lot to remove public keyword from my url http://localhost/myLaravel/public/ by its normal method of copying .htaccess folder in my laravel project directory as well as by copying and renaming server file to index.php. But it didn't work.
whenever i write this url: http://localhost/myLaravel/
it give me following error:
Forbidden
You don't have permission to access /myLaravel/ on this server.
Any solution?
Laravel app is not meant to be accessible in a subdirectory by default. You can do one of the following:
point your domain to the myLaravel/public directory, if you want a dedicated domain or subdomain
move the public directory to the root of your Laravel app, as described here: How to make public folder as root in Laravel?
You can use this htaccess code in laravel root directory.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Show white screen pages in laravel 4.2

I uploaded my code with Laravel 4.2 on a hosting share with settings.
When I go to the home page or any page on my website. I see a white page , no error nor message.
I set 'debug' => true and 777 for permissions of app/storage
My .httaccess is :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
The databese was created and the tables were imported.
Please help me! My website URL is: larintravel.com.
In the past, configuring a local PHP development environment on your machine was a headache. Installing the proper version of PHP, required extensions, and other needed components is time consuming and confusing. Instead, consider using Laravel Homestead. Homestead is a simple virtual machine designed for Laravel and Vagrant. Since the Homestead Vagrant box is pre-packaged with all of the software you need to build robust PHP applications, you can create a virtualized, isolated development environment in seconds.
http://laravel.com/docs/quick

.htacces file and MAMP

I have installed MAMP on my laptop and moved my web project (developed using CodeIgniter) under MAMP's webroot.
I use an .htaccess file to hide my index.php file within my urls and everything is working fine...almost, everything.
I'm able to surf my site locally as in my remote server but some folders/files are not recognized. Looks like they are missing or the path is not matching the physical location on my laptop.
Basically I have configuration like below:
MAMP
htdocs
myFolderSite
.htaccess
site
myApplicationFolder
.htaccess
config
controllers
views
.....
...
myPublicFolder
css
images
.....
...
Surfing my site locally css and images are not visible. All the required files are present under the proper folders within myPublicFolder.
The .htaccess file I'm using in myFolderSite appears as below
RewriteEngine On
RewriteBase /myFolderSite/
RewriteCond $1 !^(index\.php|images|upload|users|thumb|fckeditor|public|css|js|robots\.txt|sitemap2\.xml)
RewriteRule . index.php [L]
Am I missing something?
Thanks in advance
The CodeIgniter wiki has a good article on Mod Rewrite that is worth looking at. Specifically, these two lines will stop actual files and directories being redirected.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
I've used this across a few different servers and Macs, without too many problems, so hopefully it helps.

Zend: .htaccess is not working on windows now how to continue my project?

I started working on a project in the mid. We are using Zend Framework, PHP, MySql, Ajax, jQuery and jSon on Ubuntu. It was working on ubuntu.
Now I switched to Windows. I installed Wamp, Eclipse and create a host(test.dev) on windows for my project. But when start the project by test.dev. it give me the following error on browser windows:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
then i deleted the public/.htaccess file and try again. This time no error is displayed but browser page is blank. I checked the firebug(mozilla browser) and there is no response in consol.
My .htaccess file is like that:
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Can someone tell me that what problem may be and how to solve this. If you need some other information then tell me what type of information required for you to solve this.
Thanks
A 500 - Internal Server Error is often caused by something incorrect in a configuration file.
Considering it works (i.e. no error) when you delete the .htaccess file, there's probably something in it that causes troubles.
As a first idea (as there is not much in yours, except rewrite rules), are you sure that mod_rewrite is enabled ?
You can check this in your Apache configuration : there should be a line like this one :
LoadModule rewrite_module modules/mod_rewrite.so
If this doesn't help, do you have any error message in Apache's error_log file ?
The .htaccess file looks fine. My bet is the mod_rewrite module is not activated in your local Apache. Check out your httpd.conf file..
Take a look into Apache's error.log file first. It will give you detailed information about the 500 error and its cause.
What Pekka and Pascal said is right, but you can take a look to if mod_env module is loaded in your Apache configuration so you can use the SetEnv directive.
I have this same problem when I put an application in production. To my surprise, this module is not enabled in some installations.

Resources