简体   繁体   中英

how to run laravel 5 in shared hosting without composer?

so i had laravel 4 project running at my current shared hosting and everything works fine i just need to adjust a few things but it just works perfectly fine.

now i am upgrading my project to laravel 5.2 and i expect to get some adjusting to... and i already did... i follow every instruction on the forum like changing something in public/index.php

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

and add this to the top of index.php file

ini_set('eaccelerator.enable', 0);

i also changed .htaccess file with something like this

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

i also changed folder structure to match the configuration. but none of them working i always getting this error

Warning: require(/home/puskopdi/project/vendor/composer/../symfony/polyfill-mbstring/bootstrap.php): failed to open stream: No such file or directory in /home/puskopdi/project/vendor/composer/autoload_real.php on line 66

Fatal error: require(): Failed opening required '/home/puskopdi/project/vendor/composer/../symfony/polyfill-mbstring/bootstrap.php' (include_path='.:/opt/alt/php70/usr/share/pear') in /home/puskopdi/project/vendor/composer/autoload_real.php on line 66

as far as i can read it just need something in composer and my shared hosting not allowed me to instal that... they demand me to change into vps account and i don't want to do that....

so maybe there is something that i can do to make it work? because as far as i can tell composer is just something to do instaling laravel and laravel packages....

and with laravel 4 working fine in there.. i supposed there is not gonna be a big different...

and most of the sites that have solved this issue not saying i need to have composer instaled onto that.. most off them are fine with the configuration i made up there...

so maybe i was missing something....

Copy the content of your Laravel public folder into public_html of your shared hosting. Then copy all other folders and file of your Laravel project into the root directory. No other modification needed. This should work fine. But in case you want to put everything in one folder for easy reference and make your files more organized on your shared host.

Step one remain the same (All contents of public folder into public_html ), then create a directory where you put the rest of your project file.

Then edit public_html/index.php Change line 22 require __DIR__.'/../bootstrap/autoload.php'; to the directory you created.

Also do same for line 36 $app = require_once __DIR__.'/../bootstrap/app.php';

This should work fine as well. You are good.

okay, first off all i thank all of your help and effort to helping me solving this problem...

but i finally got the solution, it just like there is something wrong with my own file in vendor folder... so what i do are:

Delete vendor folder and composer.lock file then run composer clearcache command after that just run composer update or composer install command

And just reupload vendor folder and composer.lock file

在您的计算机/服务器上运行composer install,并将文件夹“vendor”复制到共享主机。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM