[英]How to install PHP Kohana framework?
I would like to install Kohana PHP framework. 我想安装Kohana PHP框架。 The site is on a shared web hotel.
该网站位于共享的Web酒店上。 I have tried to follow the instructions on Kohana's website.
我试图按照Kohana网站上的说明进行操作 。
kohana
directory kohana
目录 application/bootstrap.php
...and here comes the problem. application/bootstrap.php
...然后出现问题。 When I visit the site, this message is shown: No direct script access.
没有直接的脚本访问。
And I have no idea about what I should do. 而且我不知道该怎么办。 I haven't seen anything about this in the documentation.
我没有在文档中看到任何有关此的内容。 I have tried to give more rights to some of the files, but it's hard to know what to do.
我试图赋予某些文件更多的权利,但是很难知道该怎么做。 Anyone that has any suggestions?
有任何建议吗?
According to the instructions, you are to open application/bootstrap.php
in your text editor to make the requested changes. 根据说明,您将在文本编辑器中打开
application/bootstrap.php
以进行请求的更改。 Visiting it in your browser probably gives you that message, because at the top of Kohana files appear to be the line 在浏览器中访问它可能会给您该消息,因为Kohana文件的顶部似乎是该行
defined('SYSPATH') or die('No direct script access.');
or something similar. 或类似的东西。 This is used in many PHP projects to prevent hacking into a file that should only be included.
许多PHP项目中都使用了此功能,以防止黑客入侵只应包含的文件。
只需打开install.php并按照说明进行操作即可。
You have to change the base URL in application/bootstrap.php
, for example: 您必须在
application/bootstrap.php
更改基本URL,例如:
Kohana::init(array(
'base_url' => '/here your base url or your project name /',
'index_file' => '',
));
After that, you have to change the name of the install file (or delete it). 之后,您必须更改安装文件的名称(或删除它)。
First, follow the instructions in install.php
. 首先,按照
install.php
的说明进行操作。
If all of the mandatory options are in green, remove install.php
. 如果所有必填选项均为绿色,请除去
install.php
。
If you then see an error message instead of hello, world!
如果然后您看到的是错误消息,而不是
hello, world!
, hello, world!
, open the file application/bootstrap.php
with your text editor and replace the value of base_url
with str_replace($_SERVER["DOCUMENT_ROOT"], '', getcwd()) . DIRECTORY_SEPARATOR
,请使用文本编辑器打开文件
application/bootstrap.php
,并将base_url
的值替换为str_replace($_SERVER["DOCUMENT_ROOT"], '', getcwd()) . DIRECTORY_SEPARATOR
str_replace($_SERVER["DOCUMENT_ROOT"], '', getcwd()) . DIRECTORY_SEPARATOR
or whatever string
this code gives you. str_replace($_SERVER["DOCUMENT_ROOT"], '', getcwd()) . DIRECTORY_SEPARATOR
或此代码为您提供的任何string
。
Full code : 完整代码:
Kohana::init(
array(
'base_url' => str_replace($_SERVER["DOCUMENT_ROOT"], '', getcwd()) . DIRECTORY_SEPARATOR,
));
If you are running your app in subfolder under DocumenRoot (assuming you are using apache) you may need modify the .htaccess file 如果您正在DocumenRoot下的子文件夹中运行您的应用程序(假设您使用的是Apache),则可能需要修改.htaccess文件
RewriteBase /your-app-folder-name
RewriteBase /您的应用文件夹名称
instead of 代替
RewriteBase /
RewriteBase /
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.