Free Web Hosting Forum
Go Back   Free Web Hosting Forum > Website Building > Web Programming
Reload this Page Fatal error: require_once() [function.require]: Failed opening required 'db.php'
Reply
 
Thread Tools Display Modes
(#1)
Old
gworroll gworroll is offline
Junior Member
gworroll is on a distinguished road
 
Posts: 7
Join Date: Oct 2010
Default Fatal error: require_once() [function.require]: Failed opening required 'db.php' - 10-25-2010, 06:01 PM

I have a homebrew CMS I'm working on, I've got it functioning fine on my local server(Apache on OS X), but it doesn't work on 000.

I couldn't find a quick fix, so I decided to create a minimal test case to see if I still got the error on db.php. I did. Here is the test case. The 'echo "Hello World!"' is to verify that this test script is in fact executing.

PHP Code:
<?php 
echo "Hello World!";
require_once(
'db.php'); ?>
This file is set to permissions 755.

Here is what it gives back to me when I load that page:

Code:
Hello World!
PHP Error Message

Warning: require_once(db.php) [function.require-once]: failed to open stream: No such file or directory in /home/a2834921/public_html/test.php on line 3

Free Web Hosting

PHP Error Message

Fatal error: require_once() [function.require]: Failed opening required 'db.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a2834921/public_html/test.php on line 3
Same errors as I got on my actual code, so it appears that I nailed the simplified test case.

db.php is the PEAR DB module for PHP, which I use to access MySQL. Is there something special about using this module here? Or is an entirely different module in use? If so, could someone kindly direct me to a howto on that module so I can change my database access code? I've tried a forum search, but I could only find a few references on specific issues, not a ground up tutorial which I'd need. RTFM is a fine answer, I just need a little help finding the FM I think.
Reply With Quote
(#2)
Old
d3iti's Avatar
d3iti d3iti is offline
Super Moderator
d3iti is on a distinguished road
 
Posts: 7,518
Join Date: Jul 2009
Location: Spain
Default 10-25-2010, 07:11 PM

Hi gworr0ll,

You get that error because the server can not find the file db.php
Where you saved it? Should be in the same folder where you put the test.php file.


Recuerda realizar copias de seguridad de tus sitios web. Si este mensaje te ayudó puedes pulsar sobre el botón karma
Reply With Quote
(#3)
Old
gworroll gworroll is offline
Junior Member
gworroll is on a distinguished road
 
Posts: 7
Join Date: Oct 2010
Default 10-25-2010, 07:20 PM

db.php is not part of my code, it's a PEAR module that is normally installed alongside PHP itself. I don't think I have sufficient access to install it, as that is normally done through shell commands.
Reply With Quote
(#4)
Old
d3iti's Avatar
d3iti d3iti is offline
Super Moderator
d3iti is on a distinguished road
 
Posts: 7,518
Join Date: Jul 2009
Location: Spain
Default 10-25-2010, 07:27 PM

Hi,

If you want to include the db.php file you must upload or you must can access this file.
If it is installed you do not need to call, simply use the functions and classes that are defined within this file.

To see if this module is installed in PHP configuration looks "Members Area" -> CPanel -> "View PHP Configuration"

Edit / Add
Have you tried your test.php file in your local server?


Recuerda realizar copias de seguridad de tus sitios web. Si este mensaje te ayudó puedes pulsar sobre el botón karma

Last edited by d3iti; 10-25-2010 at 07:30 PM.
Reply With Quote
(#5)
Old
kei's Avatar
kei kei is offline
Senior Member
kei is an unknown quantity at this point
 
Posts: 264
Join Date: Jun 2010
Default 10-25-2010, 09:07 PM

out of curiosity, whats so special about this db.php file, connecting to an sql db is fairly easy, you could do that your self...

(/me is new to this)
________
Live Sex

Last edited by kei; 08-30-2011 at 06:13 AM.
Reply With Quote
(#6)
Old
gworroll gworroll is offline
Junior Member
gworroll is on a distinguished road
 
Posts: 7
Join Date: Oct 2010
Default 10-25-2010, 09:27 PM

Haven't put test.php on my local server. The local server never gave me this error in the first place, so there was no need for a simplified test case.

kei- db.php basically makes it much easier to port from one type of database to another. In ideal situations, all that it would take to bring a db.php app from MySQL to Oracle(or whatever other SQL server) would be to change the connection string. All your database access calls would then automatically adjust to what Oracle wanted. Of course, the real world can be more complicated than this ideal, but it does make supporting different backends much easier.
Reply With Quote
(#7)
Old
d3iti's Avatar
d3iti d3iti is offline
Super Moderator
d3iti is on a distinguished road
 
Posts: 7,518
Join Date: Jul 2009
Location: Spain
Default 10-26-2010, 05:55 AM

Hi gworroll,

If you had tested your test.php file on your local server you would have found that the same mistake because the concept you are using to test is incorrect.

Have you checked if 000webhost supports the module db PEAR you want to use?


Recuerda realizar copias de seguridad de tus sitios web. Si este mensaje te ayudó puedes pulsar sobre el botón karma
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com