Jump to content

Recommended Posts

Posted

I am trying to make sure the database is working, cause the program is not.

so I have done abit of php but still a newbie (I guess :) ).

 

In the test.php file I have tried include, require, and just deleting the whole line. All give me errors.

><?php
require 'db.php';
$db=DB::connect(my database info);
if (DB::isError($db)) {echo ($db->getmessage());}
?>

 

it comes back with this error

Warning: require(db.php) [function.require]: failed to open stream: No such file or directory in /home/domain/public_html/test.php on line 2

 

Warning: require(db.php) [function.require]: failed to open stream: No such file or directory in /home/domain/public_html/test.php on line 2

 

Fatal error: require() [function.require]: Failed opening required 'db.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/domain/public_html/test.php on line 2

 

Is the pear DB available to us?

Are there any suggestions?

 

Thanks for your time.

Posted

You're close. Your require statement needs to know where to look for the include. Try this:

 

>require("/home/your-cpanel-id/public_html/db.php");

 

This assumes db.php is in your public_html folder.

  • 3 weeks later...
Posted
You're close. Your require statement needs to know where to look for the include. Try this:

 

>require("/home/your-cpanel-id/public_html/db.php");

 

This assumes db.php is in your public_html folder.

Thanks

  • 4 months later...
Posted

Small PHP habit to get in to though is to use single quotes as much as possible, like you did in your require statement, as it slightly reduces overheads and increses the speed of the script.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...