Failed opening 'pages/' for inclusion (include_path='.;C:\Program Files (x86)\DevDesktop\common\pear') index.php on line 18

十年热恋 提交于 2020-01-05 06:30:12

问题


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:


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.



来源:https://stackoverflow.com/questions/40306859/failed-opening-pages-for-inclusion-include-path-c-program-files-x86-de

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!