Forum Moderators: coopster

Message Too Old, No Replies

Need some help with Fatal error

Fatal error. require()[function.require]:Failed opening required

         

awdrifter

2:37 pm on May 4, 2011 (gmt 0)

10+ Year Member



I'm trying to run this code (with my real username and password), but I'm getting this error. I tried changing the path to ./setup/lib/common.inc.php because I saw the common.inc.php file was in there, but it still gave me the same error (except now it says ./setup/lib/common.inc.php). Any ideas? Is it a problem of corrupted common.inc.php? If so, where can I download a fresh one? Thanks.

Warning: require(./lib/common.inc.php) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\zen\inc\config.php on line 14

Fatal error: require() [function.require]: Failed opening required './lib/common.inc.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\zen\inc\config.php on line 14


<?php 
/**
This Example shows how to authenticate a user using XML-RPC.
Note that we are using the PEAR XML-RPC client and recommend others do as well.
**/
require_once 'XML/RPC2/Client.php';
require_once 'inc/config.php';
$client = XML_RPC2_Client::create($apiURL);
$token = $client->login($apiLogin, $apiPassword);
$contactLists = $client->listGet($token, "", 1, 100, "", "");

foreach($contactLists as $rec) {
echo $rec['sequence'] . "] List Name: " . $rec['listname'] . "(" . $rec['id'] . ")";
echo "\t Contacts:" . $rec['contactcount'] . "\t Created Date: " . $rec['createdDate'] ;
echo "\t Updated Date: " . $rec['modifiedDate'];
echo "<br />";
}

?>

rocknbil

3:55 pm on May 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard and it's not the config . . . it's your path (somehow.) Consider . . .

require_once 'XML/RPC2/Client.php';
require_once 'inc/config.php';

This says you have some structure like this.

this-script.php
inc/config.php
XML/RPC2/Client.php

meaning, it will only access config.php and Client.php if the directories inc and XML/RPC/ are in the same directory.

Then in config.php you have

/lib/common.inc.php

... which means, wherever you are, it can't locate that path and file from there. So it's something in your path structure. On a web server you would probably want to do something like

include ($_SERVER['DOCUMENT_ROOT'] . "/lib/common.inc.php");

meaning, wherever the script is it will look starting from the document root, not from the current directory. Whether this will work for you locally, I don't know.

The other option is to mod your php.ini to include /lib as indicated by the error:

(include_path='.;C:\xampp\php\PEAR')