doomdude Posted August 14, 2011 Share Posted August 14, 2011 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 More sharing options...
Clarkeez Posted August 14, 2011 Share Posted August 14, 2011 <?php require("$_SERVER['DOCUMENT_ROOT']."admin/includes/conndb.php"); ?> You have a syntax error, it should be <?php require($_SERVER['DOCUMENT_ROOT']."admin/includes/conndb.php"); ?> good luck Link to comment https://forums.phpfreaks.com/topic/244794-require/#findComment-1257415 Share on other sites More sharing options...
xyph Posted August 14, 2011 Share Posted August 14, 2011 If all of the examples you've tried don't work, perhaps the file isn't there? Link to comment https://forums.phpfreaks.com/topic/244794-require/#findComment-1257418 Share on other sites More sharing options...
doomdude Posted August 14, 2011 Author Share Posted August 14, 2011 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 More sharing options...
ZulfadlyAshBurn Posted August 14, 2011 Share Posted August 14, 2011 require('includes/conndb.php'); Link to comment https://forums.phpfreaks.com/topic/244794-require/#findComment-1257433 Share on other sites More sharing options...
doomdude Posted August 14, 2011 Author Share Posted August 14, 2011 Those blinking brackets! lol You saved me again 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 More sharing options...
ZulfadlyAshBurn Posted August 14, 2011 Share Posted August 14, 2011 Disable magic_quotes in ur htaccess Link to comment https://forums.phpfreaks.com/topic/244794-require/#findComment-1257442 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 15, 2011 Share Posted August 15, 2011 this might help you magicqoutes.disabling Link to comment https://forums.phpfreaks.com/topic/244794-require/#findComment-1257578 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.