These are the errors I have:
Warning: include(core/init.inc.php):
failed to open stream: No such file or directory in test.php on line 2
Warning: include(): Failed opening '/core/init.inc.php'
for inclusion (include_path='.;C:\php\pear') in test.php on line 2
Here is my code:
init.inc.php
<?php
$path = dirname(__FILE__);
include("{$path}/inc/csv.inc.php");
include("{$path}/inc/users.inc.php");
?>
test.php
<?php
include('/core/init.inc.php');
?>
Normally I should have at this white screen, but I got all errors immediately, anyone have any idea that this could be?
I followed this tutorial on the web: https://www.youtube.com/watch?v=TqhSrBJHTIY (3 parts)
I think I have as in the tutorial. Yet done the same:
As written in the comments, your files are not called .inc.php - they're called .inc. That means that init.inc.php in fact, does not exist, but init.inc does.
You have two options:
Rename your init.inc to init.inc.php, csv.inc to csv.inc.php and users.inc to users.inc.php
Change your include statements to use include('core/init.inc'); instead.
Related
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.
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.
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.
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')
I have encountered a problem that I have not come accross yet when setting up a log in page using php.
The page has a error message that relates to line 1 ( require_once('../Connections/Login.php)
that states
[function.require-once]: failed to open stream: No such file or directory
Fatal Error: require_once() [function.require]: failed opening required ... (include_path='.:/usr/share/pear-php5')
I know it is probably really simple and stupid, but I'm really struggling to self-troubleshoot and would really value some help please?
This is where I have been so confused. I also thought the same, that it just couldn't find the file; however the structure is just as you have said:
htdocs/comparison.php (the log in page)
htdocs/Connections/connComparisonLogin.php
Sorry this is going to confuse you, I simplified the actual script in my original question and here is the actual error message:
Warning: require_once(../Connections/connComparisonLogin.php) [function.require-once]: failed to open stream: No such file or directory in /home/fhlinux135/s/suzukigenuine.com/user/htdocs/comparison.php on line 1
Fatal error: require_once() [function.require]: Failed opening required '../Connections/connComparisonLogin.php' (include_path='.:/usr/share/pear-php5') in /home/fhlinux135/s/suzukigenuine.com/user/htdocs/comparison.php on line 1
Have I done it all wrong?
I think your require statement should be:
require_once 'Connections/connComparisonLogin.php';
Where is your "Connections/Login.php" relative to the currrent php file.
php will look for the file relative to the current file, or, in one of the directories specified in the "include_path" php.ini setting.
The error just means php can't find the Login.php file. Assuming the page you are calling is index.php you should have a director structure like
-Dir1
|-index.php
-Connections
|-Login.php
Why are you going up a directory in your require statement? Remove the "../" from the beginning of your require_once path.