Jonas
Jonas

Reputation: 128827

How to install PHP Kohana framework?

I would like to install Kohana PHP framework. The site is on a shared web hotel. I have tried to follow the instructions on Kohana's website.

  1. Downloaded the latest stable realse (3.0.6.2)
  2. Unzipped the file to create a kohana directory
  3. Uploaded the folder to my shared hosting website.
  4. opened the url application/bootstrap.php ...and here comes the problem. 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?

Upvotes: 1

Views: 3116

Answers (5)

John Slegers
John Slegers

Reputation: 47091

  1. First, follow the instructions in install.php.

  2. If all of the mandatory options are in green, remove install.php.

  3. If you then see an error message instead of 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 or whatever string this code gives you.

Full code :

Kohana::init(
    array(
        'base_url' => str_replace($_SERVER["DOCUMENT_ROOT"], '', getcwd()) . DIRECTORY_SEPARATOR,
));

Upvotes: 0

jasonlam604
jasonlam604

Reputation: 1454

If you are running your app in subfolder under DocumenRoot (assuming you are using apache) you may need modify the .htaccess file

RewriteBase /your-app-folder-name

instead of

RewriteBase /

Upvotes: 0

jaber
jaber

Reputation: 11

You have to change the base URL in application/bootstrap.php, for example:

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).

Upvotes: 1

Ralph Sicabol
Ralph Sicabol

Reputation: 11

Just open install.php and follow the instructions.

Upvotes: 1

TNi
TNi

Reputation: 16682

According to the instructions, you are to open application/bootstrap.php in your text editor to make the requested changes. Visiting it in your browser probably gives you that message, because at the top of Kohana files appear to be the line

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.

Upvotes: 4

Related Questions