(PHP): Warning: include_once, failed to open stream: Permission denied

纵然是瞬间 提交于 2019-12-11 06:38:31

问题


Im learning how to write a Sign Up page using Php and Mysql (XAMPP).

Now, I downloaded the source code in this website:

http://net.tutsplus.com/tutorials/php/create-a-signup-form-with-email-confirmation/

and tried to make sure it works. But when openning:

 http://localhost/source/index.php

I got the following warnings:

Warning: include_once(C:\xampp\htdocs\source\inc\php\config.php) [function.include-once]: failed to open stream: Permission denied in C:\xampp\htdocs\source\index.php on line 3

Warning: include_once() [function.include]: Failed opening 'inc/php/config.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\source\index.php on line 3

Warning: include_once(C:\xampp\htdocs\source\inc\php\functions.php) [function.include-once]: failed to open stream: Permission denied in C:\xampp\htdocs\source\index.php on line 4

Warning: include_once() [function.include]: Failed opening 'inc/php/functions.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\source\index.php on line 4

Here are the lines where I got the warnings:

<?php

include_once 'inc/php/config.php';
include_once 'inc/php/functions.php';
.
.

Any Help?


回答1:


Replace this:

include_once 'inc/php/config.php';
include_once 'inc/php/functions.php';

with

include_once dirname(__FILE__) . '/inc/php/config.php';
include_once dirname(__FILE__) . '/inc/php/functions.php';



回答2:


Much of the time using full paths like that is disabled in PHP for security reasons, try changing the paths in your include statements to being relative.



来源:https://stackoverflow.com/questions/11374874/php-warning-include-once-failed-to-open-stream-permission-denied

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