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
votes
1 answer

Why the require_once is not working in following scenario?

I've following code of a function in a PHP file titled sample.php : function deleteValue($value) { $servername = "localhost"; $username = "root"; $password = "jumbo"; $dbname = "demo"; // Create connection $conn = new…
PHPLover
  • 1
  • 51
  • 158
  • 311
-1
votes
1 answer

php require_once includes files relative to file instead of working directory

I have some problems with including files relatively. The problem isn't that require_once can't find a file, but the fact that it CAN find a file in a place where the file isn't. I have stripped down the problem to three small classes. So this is my…
David
  • 1,227
  • 12
  • 23
-1
votes
1 answer

Trying to access a required files array in a PHP Class constructor

I am making a really silly error that I have no idea why. I include a file right before a class declaration like this : require_once('assets.php') //php_include_path is set to the correct folder and the file loads class A{ function…
Parijat Kalia
  • 4,929
  • 10
  • 50
  • 77
-1
votes
3 answers

require_once giving warning and fatal error

public_html > config.php public_html > A > test_file.php in test_file.php code require_once("../config.php"); works fine. shows dynamically-related files fine (config.php) in dreamweaver public_html > includes > classes > allclasses.php in…
fmask
  • 481
  • 7
  • 18
-1
votes
1 answer

require_once - does it load the whole script?

Just wondering if require_once (or any of the include type functions) loads the entire external script when you call it, or just the functions from that script as you call them from the script you are using require_once in?
Shaun
  • 2,043
  • 3
  • 27
  • 36
-1
votes
2 answers

Multiple function execution with require_once

I have a MVC and I have a function: updateVisitor() This function is called in visitors.php And visitors.php is included once time with require_one But the function is being executed three times, any idea? Is there any php debugger to see where are…
jsertx
  • 636
  • 7
  • 17
-1
votes
2 answers

How php handle files "require"ed when being accessed by multiple users?

guys, if I require a file in a php script, and it's a valid file, will this file be included only once however many times this script is accessed by users, or just included each access but which seems to be a waste of resource? By the way, I use…
Bodhi Hu
  • 196
  • 4
  • 11
-1
votes
3 answers

Why doesn't my script include Querystrings and Parameters?

Simply put: VS VS Why can this not be done, surely this should have been programmed into. And if not can I edit the raw/core PHP C files…
TheBlackBenzKid
  • 26,324
  • 41
  • 139
  • 209
-1
votes
3 answers

PHP file loaded with jQuery.ajax() can't access loaded functions

Skip to the last two paragraphs if you can't be bothered to read details of the setup... I am transitioning from a linear PHP+JavaScript CMS to an object-oriented PHP model with some bells and whistles a la jQuery and Ajax. I am trying to centralize…
Monk
  • 33
  • 1
  • 6
-2
votes
1 answer

Data isn't write in mysql database

I have two php files. Here is one and the code:
asdasdasd
  • 7
  • 3
-2
votes
2 answers

require_once connect to other website

I'm trying to get my visitor when they visit my site to auto connect to the other site once I did put this but I guess this code wouldn't work it just give me an error something like this Warning:…
Ali
  • 9,997
  • 20
  • 70
  • 105
-2
votes
1 answer

Why would PHP include_once succeed but require_once, on the same file, fail?

I have a PHP script that uses require_once to load modules. It's run hourly by CRON and was working OK Since adding another module, it still works OK overnight (presumable when the load is low) but frequently fails (crashes) during the day. I…
Mike
  • 1
  • 1
-2
votes
2 answers

Problem to import a function in a file to a class controller in Symfony

I want to add my function handleParameters() into my AuthController but I had "Expected to find a class ... while importing services from resource... but it was not found!" HandleParameters.php
-2
votes
2 answers

Is there a -webkit for Chrome or a way to get rid of whitespace caused by PHP require_once()?

Okay, so I have this little issue with PHP creating whitespace at the top of my web site when I use include(), include_once(), require(), or require_once(). I have figured out how to adjust the positioning of the appropriate elements using the CSS…
ihodonald
  • 745
  • 1
  • 12
  • 27
-2
votes
1 answer

PHP5, require_once, failed to open stream

I have a problem which I can't solve and I have been searching about this problem for days... This is my /var/log/apache2/error.log file: PHP Warning: require_once(/var/www/html/diagramo/editor/common./license.php): failed to open stream: No such…
Armin
  • 1
  • 1
1 2 3
27
28