在共享主机网站的子文件夹中安装laravel

时间:2017-12-04 11:38:35

标签: php laravel .htaccess

我试图在我的共享主机网站(不是laravel)子文件夹中安装Laravel。 例如:example.com/dev

结构:

->laravel
  ->app
  ->bootstrap
->public_html
  ...example.com folders & files
  ->dev
    ->css
    ->js
    ->.htacess
    ->index.php
    ... other Laravel public files

我的example.com/dev/index.php看起来像这样:

... laravel codes

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

require __DIR__.'/../../laravel/bootstrap/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'/../../laravel/bootstrap/app.php';

... laravel codes

问题: 当我尝试输入http://example.com/dev/浏览器抛出错误:

此页面无效 mysite.com没有发送任何数据。
ERR_EMPTY_RESPONSE

互联网上的这个问题没有任何信息/解决方案。

任何解决方案?

2 个答案:

答案 0 :(得分:0)

您的整个项目应位于1. Open the desired website in Internet Explorer 2. Go to "Compatibility View settings" (image shown below) 3. In a dialog box add your website in the list. e.g. if you are trying to use "ssconline.nic.in" , then add "nic.in" in the list 文件夹中。然后将公用文件夹的所有内容也移动到public_html。然后编辑index.php以匹配public_htmlautoload.php

的正确目录

答案 1 :(得分:0)

从你的文字中我假设你想要通过http://example.com/dev/来调用Laravel如果你的hoster允许符号链接,你可以试试这个。

-> laravel
  -> app
  -> ...
  -> public // symlinked to public_html/example.com/dev
  -> ...

-> public_html
  -> example.com folders & files
    -> dev // This is a symlink to laravel/public

我认为更好的方法是创建子域并像http://dev.example.com一样调用Laravel。这取决于你的主机如何做到这一点。