无法打开第18页的包含内容(include_path ='.; C:\ Program Files(x86)\ DevDesktop \ common \ pear')index.php [英] Failed opening 'pages/' for inclusion (include_path='.;C:\Program Files (x86)\DevDesktop\common\pear') index.php on line 18
问题描述
当我使用.htaccess文件创建项目时,出现错误.
When I make the project with .htaccess file, I got an error.
- 第一个错误是
include(D:\ learnphp \ drupal-7.43 \ site \ pages):无法打开流: 权限在第18行的D:\ learnphp \ site \ index.php中被拒绝
include(D:\learnphp\drupal-7.43\site\pages): failed to open stream: Permission denied in D:\learnphp\site\index.php on line 18
- 第二个是
include():无法打开包含的"pages/" (include_path ='.; C:\ Program Files(x86)\ DevDesktop \ common \ pear')在 D:\ learnphp \ drupal-7.43 \ site \ index.php在第18行
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
这是我的index.php
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');
这是.htaccess文件
Here is .htaccess file
RewriteEngine on
RewriteCond %[REQUEST_FILENAME] !-f
RewriteCond %[REQUEST_FILENAME] !-d
RewriteRule ^(.*)$ index.php?path=$1 [L,QSA]
推荐答案
检查目录 D:\ learnphp \ drupal-7.43 \ site \ pages 的权限/所有权.
Check the permissions / ownership of the directories D:\learnphp\drupal-7.43\site\pages.
这意味着用户 php (执行您的php脚本的用户)有权访问要包含的文件.
It's import that user php (the user that executes your php scripts) has access to the files to include.
通常,目录拥有0755权限和php文件0644就足够了.
Normally, it's enough for directories to have 0755 permissions and for php files 0644.
这篇关于无法打开第18页的包含内容(include_path ='.; C:\ Program Files(x86)\ DevDesktop \ common \ pear')index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!