require-once

Warning and Fatal error calling require_once()

I want to fetch div element from other website . on which iam having my profile, i have tried using this code. require_once('../simple_html_dom.php'); $html=file_get_html('http://www.example.com'); $ret=$html->find("div[id=frame-gallery]"); $ret=array_shift($ret); echo($ret); but this code is giving errors Warning: require_onc...

[PHP+ModalBox] require_once problem

Hello to everybody! I have this code in the __constructor $this->Reliability = new Reliability("name","url"); Problem: I got an unexpected strange error: Fatal error: Class 'Reliability' not found in "/path/" I'm using the "__autoload" method to call the required classes, but it doesn't work when I'm calling the file in a ModalB...

PHP - is it better to use require_once('filename.php') or require_once 'filename.php';

Is this just a stylistic difference, or does using require_once('filename.php') vs require_once 'filename.php' have actual load/efficiency differences? ...

require_once works without include path

I have file 1.php having a require_once for 2.php (both of them are in different folders). The issue I am having is that 1.php seems to magically include 2.php since the path for 2.php is not in 1.php. Just to be sure, I even added a set_include_path('.') before the require_once '2.php', but it still works... Is there something obvious I...

Is it worth using require_once() for memory savings?

I'd like to check if my understanding's correct about require_once(). I have a bunch of functions in file foo.php. Let's say 7/8 out of them are always used, and one of them's rather rare and rather large. I have to keep this function's definition in foo.php. Can you tell me if the following approach achieves anything, and if you think i...

Use Require_once() to include datbase connection variables correctly.

I'm a php newbie (but long time developer in other languages) and I'm trying some example db connections in "PHP, MySQL, & JavaScript". It shows an example file to include db connection variables (servername, username, password, database, etc.). I have a php file which has a handful of functions I wrote and one of them has a few SQL quer...

require_once missing doctrine zend framework

I'm integrating doctrine with Zend Framework. I've hit an error thrown from cli. It seems Zend_Application_Bootstrap_Bootstrap does not have a require_once for Zend_Application_Bootstrap_BootstrapAbstract. Has anyone hit this? my cli-config.php <?php $classLoader = new \Doctrine\Common\ClassLoader('App', __DIR__ . "/../application/mod...

PHP require problem with "./"

I have a file index.php in root directory: <?php require_once "./include/common.php"; ?> and file common.php in include folder: <?php require_once "globalConfig.php"; ?> file globalConfig in the same folder with common.php. The tree folder as: xxx/index.php xxx/include/common.php xxx/include/globalConfig.php index.php run norma...

What are the Advantages and Disadvantages of conditionally including a class file with in a method of another class in PHP?

In this question about including all the classes in a directory for an interpreter that needs all of them, it was suggested that a better way to handle the problem would be to conditionally include only the Command file that is needed for this iteration of the interpreter. For example, instead of this: require_once('CommandA.php'); req...

If the file in __autoload has a Syntax Error, then the script stops without show a message

I have an __autoload function defined for load classes automatically, if that file has a syntax error, the script stops, simply stops... without error... function __autoload( $var_class ) { require_once( "$var_class.php" ); } echo "Before load..."; new ClassName(); echo "Hello world..."; Output: Before load... How to show de SYN...

require_once() [function.require]: Failed opening required '/vars.inc' (include_path='.;C:\php5\pear')

Hey, I have several sites setup on my local machine - customerappglobal, customerapp and naturaleigh. I have just one - customerappglobal - working at the moment because thats the only one I need working. I have added the following code to my httpd.conf file: <VirtualHost *:427> # The name to respond to ServerName customerappglobal ...

[closed/typo debugged, thanks :)] PHP global, nested/inherited autoload.

PHP 5.3.3-pl1-gentoo (cli) (built: Aug 17 2010 18:37:41) Hi all, I use a simple autoloader in my project's main file (index.php): require_once("./config.php"); require_once("./app.php"); require_once("./../shared/SqlTool.php"); function __autoload($className) { $fn = 'file-not-exists-for-{$className}'; if (file_exists("....

PHP: require_once and inheritance

If I have: <?php require_once("bla.php"); class controller{.....} php> If I then create in a different file class control_A extends controller{...}, do I need to again say require_once("bla.php");, or is it inherited? What if the require_once is done inside the class controller definition? Thanks! JDelage ...

Choosing different versions of Zend Framework to load using Zend_Loader and it's issues

Okay, so, I wanna be able to choose different versions of Zend Framework (and other frameworks) using Zend_Loader. Well, the code isn't tricky at all, but the problem is, there are so many require_once lines in the framework itself that would practically make the autoloader useless. The Zend directory has to be in the include_path whic...

PHP Require Recursion (...or the lack thereof)

Alright, I'm having an issue, as many other people are seeming to have, without fix. The issue is, when I try to use require or require_once, it will work fine if the file to be required is in the same subdirectory, but the moment it sees a file outside of their subdirectory, it quits. Here is basically what the file tree looks like: mai...