Questions tagged [require-once]

The PHP require_once function

The PHP require_once function.

In contrast to require this function only includes the referred file if it has not been included before.

Use this tag only for questions that directly ask about require_once usage. Do not use this tag if your code contains require_once but you have no reason to believe that require_once is directly related to the issue you are asking about.

409 questions
2
votes
2 answers

PHP - require_once seems to be including files multiple times and causing errors

In my PHP app, I have several calls to require_once. On my development PC this works fine and doesn't try to include the same file multiple times. However when I moved it to my production server I'm getting an error cannot redeclare class myClass…
user1578653
  • 4,888
  • 16
  • 46
  • 74
2
votes
2 answers

Can you run require_once recursively in php?

Is it possible to run require_once recursively in one line like this:
nkcmr
  • 10,690
  • 25
  • 63
  • 84
2
votes
2 answers

require_once is not working (relative path)

I have a file structure as follows: >project >admin >classes >class_main.php >templates >foot.php Within class_main.php, I am trying to use require_once to require the same file, dependent on where the user is (ie, if the user is in the…
Seabody
  • 1,197
  • 1
  • 12
  • 27
2
votes
3 answers

include or require_once is giving error while using jumi on joomla 2.5

Hi I have created multiple php pages and the pages are calling other pages using require_once or include function. When I run the main script, it is showing the following error: Warning: include() [function.include]: http:// wrapper is disabled in…
user1946440
  • 349
  • 1
  • 5
  • 13
2
votes
2 answers

wp-load.php & require_once, in an ajax call

I am developing a WP Plugin. Currently, I am making an ajax call with jquery to a standalone php file in my plugin folder. Let's presume that this file is called test.php. The file is NOT loaded prior to this call, so no native wordpress functions…
Jacob Raccuia
  • 1,666
  • 1
  • 16
  • 25
2
votes
4 answers

require_once not working as I expect it to

Possible Duplicate: relative path in require_once doesn’t work I have a project structure as such: ProjectName/ src test TestClass.php tests TestTestClass.php WhenI try and do require_once…
Adam
  • 37
  • 1
  • 6
2
votes
2 answers

PHP: Failed to open required file that exists

I am trying to include the Zend_Service_Amazon_S3 file by using require_once 'Zend/Service/Amazon/S3.php'; I have also included in the include path the directory where the entire Zend library is located, AND the installation is inside Zend Server…
tombazza
  • 646
  • 9
  • 24
2
votes
1 answer

Local connection is fine, but when I deploy it to a remote server nothing happens

I have a virtual shared server through: Godaddy Plesk 11.0 Dreamweaver CS5 phpMyAdmin through Plesk. I use XAMPP for my local server and all is great! I can connect locally and I also can connect to the phpMyAdmin dbase file via Dreamweaver. It's…
2
votes
1 answer

require_once loads one file, but not the other. no errors displayed

My setup is as follows: /index.php /php/init.php /php/config.php /php/functions.php The very first thing index.php does is: init.php then goes on like this:
C.Funken
  • 51
  • 5
2
votes
3 answers

require_once ignored

strange problem with php on windows... my application loads a 'core' file that loads a settings file, registers autoloads, does initialization etc. at the top of the core file I have include_once("config.php"); this works fine for anything in the…
Michael
  • 3,498
  • 5
  • 27
  • 32
2
votes
2 answers

PHP/HTML/CSS: IE acting weird when using require_once()

Now this is the most weird problem I've ever had in PHP. All pages looks normal except one; when I first saw the problem I thought it was one of these common problems with IE and stylesheets (I've got a specific CSS-file on this page). I tried to…
Ivar
  • 4,344
  • 6
  • 38
  • 53
2
votes
4 answers

How can I specify the filesystem absolute path in a require_once in PHP?

Simply put, how do I specify an absolute filesystem path using the require_once keyword in PHP? The code will be run in CLI, not on a webpage. What is the root file path? I am running Windows, FYI. Thank you.
user717236
  • 4,959
  • 19
  • 66
  • 102
2
votes
1 answer

PHP require_once throws error locally in Mac OSX Lion

I am trying to use a relative path locally on a Mac OSX lion using require_once: require_once('../../folder/file.php5'); And it throws an error every time: PHP Warning: require_once(../../folder/file.php5): failed to open stream: No such file or…
uber_n00b
  • 163
  • 2
  • 12
2
votes
4 answers

ERROR 500 Require_once

this is my piece of php code: And when I try to browse this code in http:/mydomain/myfile.php then the browser return an error 500. Apache…
user1305760
2
votes
2 answers

How to add a require_once('file.php') statement in twig templates?

I'm new to this symfony2 and twig so I'm not very familiar with it. I need to add a require_once(file.php) into a mytemplate.html.twig but I just don't know how to do that!! :S The thing is that I have to add a social slider to my website which is…
JhovaniC
  • 304
  • 3
  • 17