I have Xampp running on Ubuntu 12.04. I have a php page in which i've included another file like include 'dbconfig.php'. But whenever I try to open the page I get an error like this:
Warning: require(1): failed to open stream: No such file or directory in /opt/lampp/htdocs/index.php on line 2
Fatal error: require(): Failed opening required '1' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/index.php on line 2
I have tried using the relative path, the full path and everything. I have also double-checked that dbconfig.php IS present in the same folder as index.php. I googled around a bit and i think the problem is that php is unable to open dbconfig.phpbecause of 'permission' issues.
I'm new to ubuntu, so I have no idea how to fix this. Can someone please help me out?
The code from index.php goes like this :
<?php
include 'dbconfig.php';
?>
Related
I have very basic knowledge of coding, I took a copy of our company's website to practice making changes to it.
But when I try to run it I get this error
Warning: require_once(/var/www/html/classes/database_class_pdo.php):
failed to open stream: No such file or directory in
D:\xampp\htdocs\HJ\top.php on line 10
Fatal error: require_once(): Failed opening required
'/var/www/html/classes/database_class_pdo.php'
(include_path='D:\xampp\php\PEAR') in D:\xampp\htdocs\HJ\top.php on
line 10
Please, can someone tell me the issue here?
Thank you.
It's because your php file is trying to open a file named /var/www/html/classes/database_class_pdo.php but cannot find it. Try to see if the path is correct or if the file exists.
I am trying to make a login system for my app, and needed to use php for it. However I'm really new to php so I got errors. First of all, I am using a free web hosting for now, so it might be the issue here. That being said, here is the error part of my php:
<?php
require_once 'include/DB_Functions.php';
?>
And it gives me this error:
Warning: require_once(include/DB_Functions.php): failed to open stream: No such file or directory in /srv/disk3/1965965/www/yigittest.atwebpages.com/login.php on line 2
Fatal error: require_once(): Failed opening required 'include/DB_Functions.php' (include_path='.:/usr/local/php-5.4.45/share/pear') in /srv/disk3/1965965/www/yigittest.atwebpages.com/login.php on line 2
However, my include folder contains all the required php files. So what might be the issue here?
Try this demo code or plz share your folder structure
require_once(__DIR__.'/../include/DB_Functions.php');
I am having the same problem on the Windows-with-xampp side of the fence as Gerardo Tarragona is having on the Ubuntu-with-lampp side. Ref: How to install phpChart lite library?
I have tried a couple or few things and the roadblock I am hitting (see PHP error messages from browser below the code snippet) seems to be that the conf.php file is trying to require_once('phpChart.php') but I cannot find this file phpChart.php anywhere on disk. It does not seem to be with the phpChart_Lite extracted download. Can anybody shed light on this ? What am I missing ?
Here is the conf.php file code:
<?php
define('SCRIPTPATH','/phpChart_Lite/');
define('DEBUG', true);
/******** DO NOT MODIFY ***********/
require_once('phpChart.php');
/**********************************/
?>
Warning: require_once(phpChart.php): failed to open stream: No such file or directory in C:\xampp\htdocs\phpChart_Lite\conf.php on line 10
Fatal error: require_once(): Failed opening required 'phpChart.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\phpChart_Lite\conf.php on line 10
Depending on your system, change SCRIPTPATH to
define('SCRIPTPATH','/phpChart_Lite');
or
define('SCRIPTPATH','phpChart_Lite/');
I have applied the google map to my local server via Xampp. I have moved it to my web hosting server and I can not get it to connect to the databse. I was able to get other db connections to work but the issue here is I must be puting the file path in incorrectly. I am using the same file structure as on my local machine.
The Errors:
Warning: require(../includes/core/db/map_dbinfo.php) [function.require]: failed to open stream: No such file or directory in /home/xxxxxxx/public_html/includes/state_map/phpsqlajax_genxml2.php on line 2
Fatal error: require() [function.require]: Failed opening required '../includes/core/db/map_dbinfo.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxxxxx/public_html/includes/state_map/phpsqlajax_genxml2.php on line 2
Anyone know why it's throwing these errors now but not on local machine and how I can go about fixing it?
I really have no idea where to start or even how to word this question. Any help would be appreciated. Thanks
You are standing in .../includes/states_map/phpsqlajax_genxml2.php and trying to reach "../includes/core/db/map_dbinfo.php". If you go back one directory from states_map you get to includes, and then you try to find includes under the includes directory.
Change the include to ../../includes/core/db/map_dbinfo.php
Why this is happening? Probably because you on your local server has .../includes added in you r include_path in php, which then will try includes/../includes/...
All,
I have the following files:
builder.php
Oauth.php
twitteroauth.php
Within my builder.php page I have the following code:
require_once('twitteroauth.php');
Then in my twitteroauth.php page I have the following code:
require_once('OAuth.php');
All of these files are in the following path: wp-content/themes/alyeska/framework/frontend/functions
I'm testing this on my localhost and it works fine. However, when I upload all of these files to my webserver I get the following error message:
Warning: require_once(OAuth.php) [function.require-once]: failed to open stream: No such file or directory in /home/arokyne/website.com/wp-content/themes/alyeska/framework/frontend/functions/twitteroauth.php on line 10
Fatal error: require_once() [function.require]: Failed opening required 'OAuth.php' (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/arokyne/website.com/wp-content/themes/alyeska/framework/frontend/functions/twitteroauth.php on line 10
I'm not sure why I'm getting these errors since it works on my localhost. Can anyone point me in the right direction on how to fix this issue?
Thanks!
Two things jump to mind- make certain your path is correct, including the case sensitivity; also, make certain that the permissions on the file allow for the php server to read the file. A 644 mode should be sufficient, I believe; but, worst case, a 755 would definitely work.
And finally you may want to check whether your include path is correct.