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
1
vote
2 answers

PHP error: open_basedir restriction in effect

I using this Yubico authentication PHP class: https://github.com/Yubico/php-yubico. I create php file test.php with this code:
Anton
  • 921
  • 3
  • 12
  • 26
1
vote
3 answers

PHP: require_once library -> failed to open stream

I might be a bit confused and may need your help with this. I'm inside inc/newsletter.php and want to include a library that is inside lib/mailchimp-api-class How do I refer to this class file? I thought it should be … require_once…
matt
  • 42,713
  • 103
  • 264
  • 397
1
vote
3 answers

How can I require a class in a PHPUnit test for Zend Framework 2?

Currently I am trying to refresh and expand my knowledge of Zend Framework 2 and I'm looking at Zend's User Guide, specifically the page on Routing and Controllers. Seeing four almost identical test functions for asserting actions can be accessed…
Brian Kessler
  • 2,187
  • 6
  • 28
  • 58
1
vote
3 answers

How require_once in joomla2.5

I Have a problem about require_once in joomla. In this file php: components\com_test\views\__test_r5\tmpl\default.php I want to include some file using this code: require_once (JPATH_ROOT.DS.'/includes/General.php'); but require_once does not…
user1798056
  • 29
  • 2
  • 4
1
vote
2 answers

Require_once is not executed on ajax call

This is my 'index.php' file (part of it):
kapantzak
  • 11,610
  • 4
  • 39
  • 61
1
vote
1 answer

php require_once file with 5000 lines vs smaller require_once files

I have read so many different answers on this topic. The more i search more diverse it gets. I have a single require_once file with all my site functions but this has grown to 5000 lines. Is it time for me to break it up and is it performance…
1
vote
1 answer

how use require_one views in cakephp

i am beginner in cakephp and i want use file with percalname.php in my view. this file have this path : app\webroot\files\percalname.php and i write this code in my view (this code is in line 17) require_once…
aya
  • 1,597
  • 4
  • 29
  • 59
1
vote
2 answers

require_once fatal error (one more time)

I have created super simple script as same as before when everything worked properly. But somehow it stopped and now everytime I try to require a file it show me an error: Fatal error: require_once(): Failed opening required…
1
vote
1 answer

no Mail class require_once php

I'm trying to use require_once to call Mail.php but when I create a new instance for that class and start using it I get a message that says Fatal error: Class 'Mail' not found in D:\xampp\htdocs\proj\Mailing\mymail.php on line xx The resumed code…
Damian Rojas
  • 35
  • 1
  • 9
1
vote
3 answers

How can i get the URL of the page that used "require_once"

I created a PHP site that has 3 pages, i.e., A, B, and C. Both A and B will call page C first by using "require_once". Is there a way for page C to know if this call came from A or B? $_SERVER['HTTP_REFERER'] didn't work.
Gary
  • 483
  • 2
  • 6
  • 17
1
vote
2 answers

ZF Include path

Is it correct to require_once? where and how would you put it include path? Should it not be in a application.ini or bootstrap? EXAMPLE: require_once 'Zend/View/Helper/Abstract.php'; // @question - is this correct - where and // how would you put…
Wil
  • 1,778
  • 1
  • 16
  • 15
1
vote
3 answers

PHP require_once not working on Linux

I've transferred a PHP web-system from a Windows hosting provider to a Linux based hosting service. In the system's scripts, when it comes to require_once, the script simply stops and leaves the user at a blank white page. I've tried both of the…
Nick
  • 53
  • 2
  • 5
1
vote
2 answers

How do I use require_once()?

I create a PHP page with the following content: I put the MaterialUtil.class.php file in…
user6919
  • 121
  • 1
  • 6
1
vote
1 answer

using require_once() with files outside of the site root

I have an application that is broken up into several sites with common files. The structure looks like this... | |--[Site A] <--Web site A points here | |-- (Files and folders) | |--[Site B] <--Web site B points here | |-- (Files and…
Ralph M. Rivera
  • 769
  • 3
  • 12
  • 25
0
votes
1 answer

how to block access to include(x_file) from a file in a certain folder?

I have a folder that contains many different files: folder1: somthing.php somthingelse.php blah.php ect ect.... Now, I don't want the files in that folder to access (include) files outside the folder. So it's okay to include('blah.php') but not…
user849137