[英]setting up laravel 5.2 in a sub doamin at a shared hosting server
I want to deploy laravel 5.2 into a sub domain named sub but i get the following error 我想将laravel 5.2部署到名为sub的子域中,但是我得到以下错误
Unable to handle the request
无法处理请求
HTTP ERROR 50HTTP错误50
I have researhed and found that i require php version 5.5.9 and above in order for laravel to run. 我已经研究并发现我需要php版本5.5.9及更高版本才能运行laravel。 I have laravel 5.5, but When i place laravel "public" folder contents into the shared host "public_html" folder it works but when i place the same content into my sub domain its not working.
我有laravel 5.5,但是当我将laravel“public”文件夹内容放入共享主机“public_html”文件夹时,它可以工作,但是当我将相同的内容放入我的子域时,它无法正常工作。
i have also changed the index.php as follows 我也改变了index.php如下
require __DIR__.'/../sub/bootstrap/autoload.php';
$app = require_once __DIR__.'/../sub/bootstrap/app.php';
After you meet the server requirements , You only need to point your subdomain to the public
directory of your laravel project directory. 满足服务器要求后 ,只需将子域指向laravel项目目录的
public
目录即可。
eg if your domain is enaveed.com
, your subdomain is flipflop.enaveed.com
and your project is in /public_html/flipflop
directory, this is how you need to configure your subdomain in a standard cpanel environment: 例如,如果您的域名是
enaveed.com
,你的子域名是flipflop.enaveed.com
和你的项目中/public_html/flipflop
目录,这是你需要如何配置你的子域在一个标准的cPanel环境:
First, you should met the server requirement: https://laravel.com/docs/5.2/installation#server-requirements 首先,您应该满足服务器要求: https : //laravel.com/docs/5.2/installation#server-requirements
Second, you should upload all the files of laravel into your public_html 其次,你应该将laravel的所有文件上传到你的public_html中
Third, change the name of server.php to index.php 第三,将server.php的名称更改为index.php
fourth, copy .htaccess file from laravel "public" folder to your public_html 第四步,将laravel“public”文件夹中的.htaccess文件复制到你的public_html
require __DIR__.'/../sub/bootstrap/autoload.php';
$app = require_once __DIR__.'/../sub/bootstrap/app.php';
Those paths look wrong. 那些路径看起来不对。
in index.html file in your sub folder, change the paths like below. 在子文件夹的index.html文件中,更改如下所示的路径。
require DIR .'/../../laravel/bootstrap/autoload.php'; 需要DIR 。'/ .. / .. / laravel / bootstrap / autoload.php';
$app = require_once DIR .'/../../laravel/bootstrap/app.php'; $ app = require_once DIR 。'/ .. / .. / laravel / bootstrap / app.php';
$app = new Illuminate\\Foundation\\Application( $ app = new Illuminate \\ Foundation \\ Application(
realpath( DIR .'/../') realpath( DIR 。'/ .. /')
); );
to 至
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../../laravel/')
);
Go to Bootstrap/autoload.php file and change 转到Bootstrap / autoload.php文件并进行更改
require DIR .'/../vendor/autoload.php'; 要求DIR 。'/ .. / vendor / autoload.php';
to 至
require __DIR__.'/../../laravel/vendor/autoload.php';
It should work now. 它现在应该工作。
(PS I don't like this markdown typing. it shows some of my codes in block but does not some of them) (PS我不喜欢这种降价打字。它显示了我的一些代码,但没有一些代码)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.