php including error 4 - php

when I include admin_functions.php file with this address:
../../functions/admin_functions.php
it shows me these errors:
Warning: include_once(../../functions/admin_functions.php):
failed to pen stream: No such file or directory
in D:\wamp64\www\CMS\admin\moduls\admin\add.php
and
Warning: include_once():
Failed opening '../../functions/admin_functions.php'
for inclusion (include_path='.;C:\php\pear')
in D:\wamp64\www\CMS\admin\moduls\admin\add.php
But when I include this file with local address:
D:\wamp64\www\CMS\admin\functions\admin_functions.php
my project is running without any error.
I really checked that my first address isn't wrong and the both addresses are exactly the same file (admin_functions.php).
So whats wrong with that?

You must check that include_once(../../functions/admin_functions.php) has the right number of "../" to reach functions directory. Simple solution: try adding/removing "../" to your path until it works.

Related

moved website: failed to open stream no such file or directory

I have seen different variations of this problem which I have tried to use without any success so i figured it would be best just to ask.
I recently moved my website from my wamp server over to my qnap server. Seams to be working quite well except 3 errors that popped up (did not have them on my local host and havent changed any of the code).
I get the following 3 errors.
Warning: include(/share/HDA_DATA/Web/application/views/errors/html/error_php.php): failed to open stream: No such file or directory in /share/HDA_DATA/Web/system/core/Exceptions.php on line 269
Warning: include(): Failed opening '/share/HDA_DATA/Web/application/views/errors/html/error_php.php' for inclusion (include_path='.:/etc/config/php') in /share/HDA_DATA/Web/system/core/Exceptions.php on line 269
Warning: include(/share/HDA_DATA/Web/application/views/errors/html/error_php.php): failed to open stream: No such file or directory in /share/HDA_DATA/Web/system/core/Exceptions.php on line 269
Warning: include(): Failed opening '/share/HDA_DATA/Web/application/views/errors/html/error_php.php' for inclusion (include_path='.:/etc/config/php') in /share/HDA_DATA/Web/system/core/Exceptions.php on line 269
I seam to understand what is going on that it cannot access the file but can anyone point out what i need to change and where/which file i need to change it. I have not done any changes to my codeigniter file structure (all original setup). If you need code dump just let me know from which file.
Thank you for your help.
Jonas

getting error in libchart library in php

i want to draw a piechart in php using mysql. i am getting error only for below code.
<?php include "libchart/classes/libchart.php"; ?>
during run i am getting below error. anyone please help me.
Warning: include(libchart/classes/libchart.php) [function.include]:
failed to open stream: No such file or directory in
C:\xampp\htdocs\g2.php on line 2
Warning: include() [function.include]: Failed opening
'libchart/classes/libchart.php' for inclusion
(include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\g2.php on line
2
It means the file C:\xampp\htdocs\libchart\classes\libchart.php does not exist
it seems you giving wrong path for file. I think you should tell your directory path too here i.e where is the file in which you including the file and the file path which you want to include.

PHP Error - Can't Open Files

I am building a small PHP system, and I can't open files like CSS Styles, PHP Include function and Images.
I also got some errors:
Warning: include(includes/functions.php) [function.include]: failed to open stream: No such file or directory in /home/chezki/public_html/XXX.XXX/cp/CMS/index.php on line 2
Warning: include(includes/functions.php) [function.include]: failed to open stream: No such file or directory in /home/chezki/public_html/XXX.XXX/cp/CMS/index.php on line 2
Warning: include() [function.include]: Failed opening 'includes/functions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/chezki/public_html/XXX.XXX/cp/CMS/index.php on line 2
Built by YYY.YYY
logo // Thats the Logo alt
Fatal error: Call to undefined function getlists() in /home/chezki/public_html/XXX.XXX/cp/CMS/index.php on line 28
Title Actions // Some images alt
Edit: On Windows, It is Ok, but on Linux, It is doing those errors
More edit: Solved
From your error messages, your script appears to be this:
/home/chezki/public_html/XXX.XXX/cp/CMS/index.php
Your are trying to load this file:
includes/functions.php
Since you get this error message:
No such file or directory
... the obvious conclusion is that this file does not exist:
/home/chezki/public_html/XXX.XXX/cp/CMS/includes/functions.php
Feel free to edit your question and provide more details if this is not the case.
Edit: the file must have that precise name. If it's called e.g. Functions.php, it's a different file.
You have permission problems. Your web server cannot read functions.php due to wrong permissions. Adjust permissions with chown and chmod.

Failed opening '../tweets.php' for inclusion (include_path='.:')

I am trying to include a script using the following code.
<div class="main_content">
<?php include ('tweets.php') ?>
</div>
But it keeps throwing up the following error.
Warning: include(tweets.php): failed to open stream: No such file or
directory in - on line 52 Warning: include(): Failed opening
'tweets.php' for inclusion (include_path='.:') in - on line 52
I have checked and double checked and the file definitely exists and is in the same directory as the file that this is in.
I really appreciate your help on this.
The path is relative to the file where the request was initiated.
So, even if it's in the same folder as the file it's including, if that file was included from a file in a different folder, you will have to use an absolute path or a path relative to the original file.
Try using include('./tweets.php');. If that does not resolve your issue, it's most likely file permissions. Give everyone full permissions for tweets.php and see if that works.
As #Josh says, the path is relative to the file that received the request, so you can exploit the PHP __DIR__ magic constant:
include(__DIR__ . '/tweets.php');
1.)if you have 2 different variables is a different scenario like same name one variable with upper case and one variable with lower case...different solution you are right thank you very much
2.)but if someone could change the variables to be complete different variables names they may not have that problem....not always the case
same message but i fix it...cleaning all the blank spaces before and after php symbols <?php and ?>
make sure { and } are not missing and where they need to be
make sure this syntax is correctly where it need to be { and <?php } ?>
No need for an extra path... Thank You very much
Warning: include(tweets.php): failed to open stream: No such file or directory in - on line 52 Warning: include(): Failed opening 'tweets.php' for inclusion (include_path='.:') in - on line 52
That's because your file name not found due to "case sensitive". Example "./Core/admin.php" and "./core/admin.php" are diffrent.

php: error importing file, no matter which path i use: absolute/"dotDOTslash", i get an error saying the file doesn't exist, but it does exist, wtf?

okay so as the question says: i'm including files in a file, but i keep getting "no such file or directory" errors. and it really doesn't make sense to me, because i've checked them, i've checked their permissions and they're the same as those that i can include in other scripts
just so you know: these includes are being made by a file that is being included within another
ie: login.php - includes - check_login.php (which is the file that yields these errors)
here are my current includes:
include('/home/user/public_html/taxnetwork.co.za/main/db/select_all.php');
require_once('input_cleaner.php');
include('/home/user/public_html/taxnetwork.co.za/main/db/insert.php');
require_once('/home/user/public_html/taxnetwork.co.za/main/mail/mailer.php');
and these are the errors i'm getting:
Warning: require_once(./db/insert.php) [function.require-once]: failed to open stream: No such file or directory in /home/user/public_html/taxnetwork.co.za/main/mail/mailer.php on line 2
Fatal error: require_once() [function.require]: Failed opening required './db/insert.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/taxnetwork.co.za/main/mail/mailer.php on line 2
as warning say - you have the problem in
/home/user/public_html/taxnetwork.co.za/main/mail/mailer.php on line 2
then look in it and you will see there require_once(./db/insert.php)
you can change it to:
require_once('/home/user/public_html/taxnetwork.co.za/main/db/insert.php')
or to :
require_once(realpath(dirname(__FILE__).'/../../').'/db/insert.php')

Categories