jrapin Posted November 9, 2006 Share Posted November 9, 2006 PHP People,I am attempting to correct a syntax error in a PHP file.The file uses the require once command. I need to indicate the correct directory for a file that will be uploaded to a FTP server.Could you help me determine the correct syntax for the DB.php file? Since it is only on the C-Drive, and the file is requiring it once, does it have to be uploaded to the FTP space would a correction in the directory be sufficent?I know a correction in the directory is necessary because AI have received this error message "Fatal error: Failed opening required 'DB.php' (include_path='C:/php/pear') in /home/webadmin/jupiter.com/html/calendar/cal_inc.php on line 4?Respectfully,Jesse R.the Cal_inc.php file looks like this:<?phpfunction connect() { ini_set("include_path", "C:\php\pear"); require_once("DB.php"); $type = "mysql"; $username = "caladmin"; $password = "caladmin"; $host = "localhost"; $database = "event_calendar"; $dsn = $type . "://" . $username . ":" . $password . "@" . $host . "/" . $database; $dbconn = DB::connect($dsn); errortrap($dbconn); $dbconn->setFetchMode(DB_FETCHMODE_ASSOC); return $dbconn;}//end connect Link to comment https://forums.phpfreaks.com/topic/26720-php-syntax-error/ Share on other sites More sharing options...
blear Posted November 9, 2006 Share Posted November 9, 2006 You cant require_once() files on your local machine when accessing /home/webadmin/jupiter.com/html/calendar/cal_inc.php , unless your local machine has its own webserver, it just doesnt work that way. Link to comment https://forums.phpfreaks.com/topic/26720-php-syntax-error/#findComment-122226 Share on other sites More sharing options...
Psycho Posted November 9, 2006 Share Posted November 9, 2006 Yes, you need to put the file somewhere that the web server has access to it. And the command require_once does not mean that it is ONLY accessed once. Every time the page is called it will need to access that required file. The require_once is used in case your code *may* attmept to call the file multiple times in one call. If the included page has functions it would throw an error if called twice. Link to comment https://forums.phpfreaks.com/topic/26720-php-syntax-error/#findComment-122228 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.