Jump to content

require()


doomdude

Recommended Posts

Hey guys,

 

This code works on my local host, but once I upload it to a server I get the error:

 

Fatal error: require() [function.require]: Failed opening required '/admin/includes/conndb.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/u933029346/public_html/admin/includes/config.php on line 3

 

Page:

<?php include("includes/config.php"); ?>
<body>
   <?php include("includes/header.php"); ?>
   
   	<div id="admincontentinstall">
<h1>Welcome to the installer.</h1>

<?php 
// Connects to your Database 
mysql_connect("$dbhost", "$dbuser", "$dbpass") or die(mysql_error()); 
mysql_select_db("$dbname") or die(mysql_error()); 
mysql_query("CREATE TABLE accounts ( 
  id int(5) UNSIGNED NOT NULL AUTO_INCREMENT, 
  Account_name varchar(60) NOT NULL default '', 
  Password varchar(30) NOT NULL default '', 
  IP_address varchar(20) NOT NULL default '', 
  pin int(11) NOT NULL default '0',
  date datetime NOT NULL default ' 0000-00-00 00:00:00',
  PRIMARY KEY  (id) 
);")or die(mysql_error()); 

Print "Your table has been created"; 
?> 

</div>

</body>

 

config.php:

<?php



require("$_SERVER['DOCUMENT_ROOT']."admin/includes/conndb.php");




$db = mysql_connect($dbhost, $dbuser, $dbpass); 
mysql_select_db($dbname,$db); 
?>

 

conndb.php:

<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'test'; //database name
$dbdata = 'accounts'; // table name
?>

 

I've tried using:

 

require("admin/includes/conndb.php");

require("/includes/conndb.php");

require("/conndb.php");

require("conndb.php");

 

All of which still say it cannot be found? Anyone have any ideas why?

Link to comment
https://forums.phpfreaks.com/topic/244794-require/
Share on other sites

The files 100% there lol. I've tried the fix Clarkeez recommended didn't fix it :(

 

Warning: require() [function.require]: open_basedir restriction in effect. File(/usr/local/apache/htdocsadmin/includes/conndb.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/u429522361/public_html/admin/includes/config.php on line 5

Link to comment
https://forums.phpfreaks.com/topic/244794-require/#findComment-1257423
Share on other sites

Those blinking brackets! lol

 

You saved me again :D

 

While you here lol.

 

I've noticed editing the conndb.php does this to the code:

 

<?php

$dbhost = 'localhost';

$dbuser = '//u429522361_uber//';

$dbpass = '//123456//';

$dbname = '//u429522361_uber//'; 

$dbdata = '//accounts'//; 

?>

 

Is it something to do with the text field?

Link to comment
https://forums.phpfreaks.com/topic/244794-require/#findComment-1257435
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.