简体   繁体   English

如何在没有作曲家的共享主机中运行laravel 5?

[英]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. 所以我有laravel 4项目运行在我目前的共享主机,一切正常,我只需要调整一些东西,但它只是工作得很好。

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 现在我正在将我的项目升级到laravel 5.2,我期望得到一些调整......我已经做了...我按照论坛上的每一条指令,如在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 并将其添加到index.php文件的顶部

ini_set('eaccelerator.enable', 0);

i also changed .htaccess file with something like this 我也用这样的东西改变了.htaccess文件

<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.... 据我所知,它只需要作曲家的东西和我的共享主机不允许我安装......他们要求我换成vps帐户,我不想那样做....

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.... 因为据我所知,作曲家只需要安装laravel和laravel包....

and with laravel 4 working fine in there.. i supposed there is not gonna be a big different... 并且laravel 4在那里工作正常..我认为不会有一个很大的不同......

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. 您Laravel的内容复制public文件夹到public_html你的共享主机。 Then copy all other folders and file of your Laravel project into the root directory. 然后将Laravel项目的所有其他文件夹和文件复制到根目录中。 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. 第一步保持不变( public文件夹的所有内容都放入public_html ),然后创建一个目录,在其中放置项目文件的其余部分。

Then edit public_html/index.php Change line 22 require __DIR__.'/../bootstrap/autoload.php'; 然后编辑public_html/index.php更改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'; 同样对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 删除vendor文件夹和composer.lock文件,然后运行composer clearcache命令,然后运行composer updatecomposer install命令

And just reupload vendor folder and composer.lock file 然后重新上载vendor文件夹和composer.lock文件

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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