Failed opening 'pages/' for inclusion (inc

2019-07-29 10:57发布

When I make the project with .htaccess file, I got an error.

  1. The first error is

include(D:\learnphp\drupal-7.43\site\pages): failed to open stream: Permission denied in D:\learnphp\site\index.php on line 18

  1. The second one is

include(): Failed opening 'pages/' for inclusion (include_path='.;C:\Program Files (x86)\DevDesktop\common\pear') in D:\learnphp\drupal-7.43\site\index.php on line 18

Here is my index.php

<?php

// Moved functions to their own file so we can use them in page files.
include('includes/functions.php');

// If this is index.php, we won't get a path, so we need to set it.
$path = isset($_GET['path']) ? $_GET['path'] : 'home.php';


// Render featured products.
$featured_product_output = render_product(get_setting('featured_product_ids'));

// Get some variable to use in the templates.
$company_name = get_setting('company_name');
$year = date('Y');

// Include the file that matches the path name.
include('pages/' . $path);

include('includes/page-template.php');

Here is .htaccess file

RewriteEngine on
RewriteCond %[REQUEST_FILENAME] !-f
RewriteCond %[REQUEST_FILENAME] !-d
RewriteRule ^(.*)$ index.php?path=$1 [L,QSA]

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-07-29 11:14

Check the permissions / ownership of the directories D:\learnphp\drupal-7.43\site\pages.

It's import that user php (the user that executes your php scripts) has access to the files to include.

Normally, it's enough for directories to have 0755 permissions and for php files 0644.

查看更多
登录 后发表回答