no such file or directory found in php - php

i have been trying to include the files using the code:
define('IN_PHPBB', true);
$phpbb_root_path='./../../';
$iai_root_path = "./";
include($phpbb_root_path.'extension.inc');
include($phpbb_root_path.'common.'.$phpEx);
include($iai_root_path.'includes/constants.'.$phpEx);
include($iai_root_path.'includes/load_functions.'.$phpEx);
I am getting the following error and i have been scratching my head for quite a while now ,don't know here am i going wrong
Warning: include(./../../extension.inc) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\alice\mods\iai\install.php on line 33
Warning: include() [function.include]: Failed opening './../../extension.inc' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\alice\mods\iai\install.php on line 33
Notice: Undefined variable: phpEx in C:\xampp\htdocs\alice\mods\iai\install.php on line 34

Does your phpbb install live here "C:\xampp\htdocs\alice\" ?
Should you infact set $phpbb_root_path='../../../';

I sorted this problem by writing my include statement by including a $_SERVER['DOCUMENT_ROOT']
include $_SERVER['DOCUMENT_ROOT'] . "includes/functions.php";
As for why this works, im not so sure.

Related

ERRORS with INCLUDE_ONCE Global Variable PHP

I created a config file that has a variable I want to use as a constant.
<?php
$ROOT_PATH = 'C:/Users/me/Documents/app-qas.com/site';
?>
On a CLASS page where I want to use the variable I added the following before instantiating the CLASS:
include_once("config.php");
$root=$ROOT_PATH;
I made the appropriate scoping changes to the functions in my class as follows:
global $root;
include_once($root."/Library/API/database.inc.php");
When I run my app, it DOES perform all of the data connections it
is designed to do, BUT it STILL returns the following errors:
Warning: include_once(config.php): failed to open stream: No such file
or directory in
C:/Users/me/Documents/app-qas.com/site'\class\Posting.class.php on
line 5
Warning: include_once(): Failed opening 'config.php' for inclusion
(include_path='.;C:\php\pear') in
C:/Users/me/Documents/app-qas.com/site'\class\Posting.class.php on
line 5
Notice: Undefined variable: ROOT_PATH in
C:/Users/me/Documents/app-qas.com/site'\class\Posting.class.php on
line 6
Warning: include_once(/Library/API/database.inc.php): failed to open
stream: No such file or directory in
C:/Users/me/Documents/app-qas.com/site'\class\Posting.class.php on
line 112
Warning: include_once(): Failed opening
'/Library/API/database.inc.php' for inclusion
(include_path='.;C:\php\pear') in
C:/Users/me/Documents/app-qas.com/site'\class\Posting.class.php on
line 112
Warning: include_once(/Library/API/database.inc.php): failed to open
stream: No such file or directory in
C:/Users/me/Documents/app-qas.com/site'\class\Posting.class.php on
line 112
Warning: include_once(): Failed opening
'/Library/API/database.inc.php' for inclusion
(include_path='.;C:\php\pear') in
C:/Users/me/Documents/app-qas.com/site'\class\Posting.class.php on
line 112
If I comment out the include and hard code the $root it runs like before BUT it DOES NOT throw any errors:
#include_once("joblaunch.php");
#$root=$ROOT_PATH;
$root='C:/Users/me/Documents/app-qas.com/site';
I don't understand why it runs and throws errors when getting the variable from the config.php but runs and doesn't throw an error when hard coding the path.
if you define a constant instead of a variable, this problem should be solved,
definition
old:
$ROOT_PATH = 'C:/Users/me/Documents/app-qas.com/site';
new:
define('ROOT_PATH', 'C:/Users/me/Documents/app-qas.com/site');
usage
old:
$root=$ROOT_PATH;
new:
$root = ROOT_PATH;

include in php not working

<?php
include("/Crypt/RSA.php");
$rsa = new Crypt_RSA();
$token=base64_decode("iKmHdK3ChRBPAU/I/wTKld4up91TMrcWjkE+VGggVryRzvhKC6l+sZ3F+j+qyW8rxg01/uu2E3z6aVirwmQ0ig==");
$private=base64_decode("MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAyUFH4OJOUOKh38raMxiQhmtuNSMxcznSdt9fWiJZOYpnv1rbu3h/heNCIOxOHSrlMz8FAKAW6rd9ddXNcm4myQIDAQABAkEApGbPcMVtdGWuFkJ/PH40kZnwzTeSja4OX0zZd6fXe0hBZZjA1nREuLGh2x7OXkpArytgQ35W2NHCxeldniTmgQIhAO7SB0Mhb/HLst4ty6HT2kZoAC/N2UdsBtQFdC8sNNxXAiEA17t4cVsx5EYYFifDSUwawz5pJSfrQYk1C0H1atL9Id8CIQDOtJL8k7BkxD5o95JM2yUN02518eGiY+n1EVNikQyfuQIgdph88fQsTU2rWCKr3NOVstfQfbigP/rpyjKMdBlhRwkCIE/x13OF2JUHlA5DqxCVh3LHMDDowr7SkQ2QVkqfBcAb");
$rsa->loadKey($privateKey);
echo $rsa->decrypt($cipher);
?>
i kept my include_path as .:/usr/local/lib/php
i am getting errors like this:
Warning: include(/Crypt/RSA.php) [function.include]: failed to open stream: No such file or directory in /home/futureti/public_html/reg2.php on line 2
Warning: include() [function.include]: Failed opening '/Crypt/RSA.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/futureti/public_html/reg2.php on line 2
Fatal error: Class 'Crypt_RSA' not found in /home/futureti/public_html/reg2.php on line 3
Try this:
include('../Crypt/RSA.php');
Your current leading / is creating an absolute link, so going right back to your root directory.
../ means one folder up.
Try using the document root variable:
$doc_root = $_SERVER['DOCUMENT_ROOT'];
include($doc_root . "/Crypt/RSA.php");

Magento site crashed after enable compilation

Hey my Magento site crash after I enable compilation, I cant login to the site, so I am trying to disable it from the back end (config.php) but its disable
define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');
define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');
any ideas?
Following are the error codes
Warning: include_once(/home3/webcapt/public_html/campusclub/includes/src/Mage_Core_functions.php) [function.include-once]: failed to open stream: No such file or directory in /home3/webcapt/public_html/campusclub/app/Mage.php on line 36
Warning: include_once() [function.include]: Failed opening '/home3/webcapt/public_html/campusclub/includes/src/Mage_Core_functions.php' for inclusion (include_path='/home3/webcapt/public_html/campusclub/includes/src:.:/usr/lib/php') in /home3/webcapt/public_html/campusclub/app/Mage.php on line 36
Warning: include_once(/home3/webcapt/public_html/campusclub/includes/src/Varien_Autoload.php) [function.include-once]: failed to open stream: No such file or directory in /home3/webcapt/public_html/campusclub/app/Mage.php on line 37
Warning: include_once() [function.include]: Failed opening '/home3/webcapt/public_html/campusclub/includes/src/Varien_Autoload.php' for inclusion (include_path='/home3/webcapt/public_html/campusclub/includes/src:.:/usr/lib/php') in /home3/webcapt/public_html/campusclub/app/Mage.php on line 37
Fatal error: Class 'Varien_Autoload' not found in /home3/webcapt/public_html/campusclub/app/Mage.php on line 53
To disable the compilation via code just rename the includes diectory from magento root folder & try to login hope this will help you.
Its may be the issue with cache. After renaming the cache folder also, it will show the same error. you can clear cache through index.php of magento by
$app = Mage::app();
if ($app != null)
{
$cache = $app->getCache();
if ($cache != null)
{
$cache->clean();
}
}
Hope it will work!

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

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?
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';
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.
Try to set the folder permission to '754'. Only the folder permission.

How can I set an absolute path for include function in php above the working directory?

I am running a script from
/wp-content/themes/currenttheme/chat.php
I want to include in the above php another one located in
/forum/chat/index.php
The index.php includes its own files
I already tried
$root = $_SERVER['DOCUMENT_ROOT'];
include($root."/forum/chat/index.php");
but I get this error
Warning: require(D:/My Dropbox/xampp/htdocs/lib/custom.php) [function.require]: failed to open stream: No such file or directory in D:\My Dropbox\xampp\htdocs\forum\chat\index.php on line 17
Fatal error: require() [function.require]: Failed opening required 'D:/My Dropbox/xampp/htdocs/lib/custom.php' (include_path='.;\My Dropbox\xampp\php\PEAR') in D:\My Dropbox\xampp\htdocs\forum\chat\index.php on line 17
(the index.php also includes some files, but the /forum/chat is ommited somehow in the path)
then I tried
$path = getcwd();
$myfile = "/forum/chat/index.php";
include ($path.$myfile);
and got this error:
Warning: include(D:\My Dropbox\xampp\htdocs\forum/forum/chat/index.php) [function.include]: failed to open stream: No such file or directory in D:\My Dropbox\xampp\htdocs\wp-content\themes\currenttheme\chat.php on line 24
Warning: include() [function.include]: Failed opening 'D:\My Dropbox\xampp\htdocs\forum/forum/chat/index.php' for inclusion (include_path='.;\My Dropbox\xampp\php\PEAR') in D:\My Dropbox\xampp\htdocs\wp-content\themes\currenttheme\chat.php on line 24
There is no problem with index.php. It is being included.
The error message says about custom.php file
Just use the same $_SERVER['DOCUMENT_ROOT'] technique for the custom.php
you have to add /forum/chat manually as there is no path to be omitted
Something wrong with:
include('../../../forum/chat/index.php');
?
There are all sorts of reasons why the code you've published will fail.
C.
use this.
require_once(ABSPATH.'forum/chat/index.php');
here ABSPATH = WordPress physical root directory path with trailing slash

Categories