如何安装LARAVEL 5 [英] How to install LARAVEL 5

查看:81
本文介绍了如何安装LARAVEL 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在托管服务器/任何其他免费托管服务器上安装laravel.我已经在localhost学习并完成了工作代码.但是我想在真实的服务器上运行它.

how to install laravel on hostinger server/ any other free hosting server. I had learned and done working codes in localhost. But i would like to run it on a real server.

Laravel版本:5

Laravel Version : 5

PHP版本服务器:5.5.35

PHP Version Server :5.5.35

1)我已将完整的laravel代码复制到"/home/<用户名>/"

1) I had copied the full laravel code to "/home/< username >/"

2)将/home//laravel/public中的文件复制到/home/<用户名>/public_html

2) copied the files in /home//laravel/public to /home/< username >/public_html

但是它显示了一个错误.

But it shows an error.

致命错误:require():无法在/home//中打开所需的'/home//public_html/../bootstrap/autoload.php'(include_path ='.:/opt/php-5.5/pear')第22行的public_html/index.php

Fatal error: require(): Failed opening required '/home//public_html/../bootstrap/autoload.php' (include_path='.:/opt/php-5.5/pear') in /home//public_html/index.php on line 22

答案: 将Heroku Server用作注释中建议的@lciamp

Answer : Use Heroku Server as @lciamp Suggested in the comment

说明:

请向我建议支持Laravel Framework的付费服务器列表

Please suggest me a list of Payed Servers which support Laravel Framework

推荐答案

由于您具有SSH访问权限,请执行以下操作:

  1. SSH进入服务器
  2. 将目录更改为项目根目录
    • cd /home/< username >
  1. SSH into the server
  2. Change directory to the project root
    • cd /home/< username >
  • rm -rf public_html
  • ln -s /home/< username >/public /home/< username >/public_html
  • composer install
  • chmod -R 755 *
  • chmod -R 777 storage/ bootstrap/cache/
  • chmod -R 755 *
  • chmod -R 777 storage/ bootstrap/cache/

清单

  1. 确保您的环境文件已上传且正确.
  2. 如果服务器是Apache,请确保您已上传.htaccess文件.
  3. 您可能已上载了所有资产,如果这样,则无需进行Bower或npm.
  4. 重新启动服务器.
  1. Make sure your environment file uploaded and is proper.
  2. If the server is Apache, make sure you uploaded the .htaccess files.
  3. You probably uploaded all the assets, if so you will not need to do bower or npm.
  4. Restart the server.

**在有限的Shell环境中

  1. 在本地安装Laravel依赖项,并上传vendor文件夹以及其他所有内容.
  2. 不是将整个Laravel应用程序上传到/home/< username >/,而是将其上传到/home/< username >/public_html.
  3. 修改您的/home/< username >/public_html/.htaccess,以将所有请求重定向到public子文件夹.

  1. Install Laravel dependencies locally and upload the vendor folder with everything else.
  2. Instead of uploading the whole Laravel app to /home/< username >/ upload it to /home/< username >/public_html.
  3. Modify your /home/< username >/public_html/.htaccess to redirect all requests to the public subfolder.

# /home/< username >/public_html/.htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect All Requests To The Subfolder
    RewriteRule ^ /public

</IfModule>

  • 确保您具有正确的/home/< username >/public_html/public/.htaccess( GitHub ).

    # /home/< username >/public_html/public/.htaccess
    
    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews
        </IfModule>
    
        RewriteEngine On
    
        # Redirect Trailing Slashes If Not A Folder...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)/$ /$1 [L,R=301]
    
        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    
        # Handle Authorization Header
        RewriteCond %{HTTP:Authorization} .
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    </IfModule>
    

  • 这篇关于如何安装LARAVEL 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆