Questions tagged [php-include]

The `include()` function in PHP includes code from other PHP files and copies them into the file that uses the include statement.

The include() function in PHP includes code from other PHP files and copies them into the file that uses the include statement.

It is identical to the require() function, except that whilst the include function will emit a warning (E_WARNING) when no file is found, the require function will throw a fatal error (E_COMPILE_ERROR), which will cause the script to abort.

Each time a file is included through the include function, the file will be read and executed. To include a PHP script just once, you can use the include_once() function.

252 questions
1
vote
0 answers

php include file autocompletion path uploaded on server differs

root/ controller/ controller.php view/ view.php index.php I launch the index.php, it includes controller.php and from controller.php I want to include view.php. What's the best way to do it? The problem is NetBeans autocomplete wants…
Edvard Rejthar
  • 1,245
  • 13
  • 14
1
vote
2 answers

Splitting tags with a PHP Include

So I'm setting up a portfolio and print selling website, and a lot of the text on the individual product pages is going to be generic. To avoid typing and make updates easier I'm thinking about heavily using php includes. I'm wondering if it's safe…
Lee Saxon
  • 457
  • 3
  • 14
1
vote
0 answers

PHP different php.ini in browser and terminal

I'm trying to run some phpUnit tests in phpstorm and I faced a problem PHP Fatal error: Class 'Money' not found in ... As I asumed my include paths are different when I run script in browser and in terminal. I tried to echo my include path in…
Daria
  • 861
  • 11
  • 29
1
vote
1 answer

Send an email with a variable defined in another file

I have file html like example.php Url and i want send mail with this file with variable defined in send.php
kamo
  • 15
  • 5
1
vote
0 answers

Receiving PHP Parse error for common.inc but the include command (indicated in the error) is not in the file

Our site is externally hosted. It's using Drupal (very outdated and the higher ups are reluctant to upgrade). We have several pages that connect to a database on a different server (hosted by a different company) to display scheduling…
1
vote
1 answer

Is "including" functions officially supported in PHP?

I'm working with Sage from roots.io and noticed that they are "including" functions (not files), like: I really like this approach, but I've been all through the PHP docs, and my Google-fu is failing me…
Mike Everhart
  • 408
  • 3
  • 10
1
vote
2 answers

Including stylesheets from header.php with a relative path

i am working on a website and i am looking for a way to include all my stylesheets and scripts relatively. Including the php-files is easy: or or by referencing the…
1
vote
2 answers

Get path of parent file from included file in php, I don't need the folder path but the full path of including page

I have a php file that could be included in different places. I need to have some rule on what to show depending on the including file. Using $_SERVER['REQUEST_URI'] is returning the path of the page itself not the parent file that's including it.
Lamar
  • 1,761
  • 4
  • 24
  • 50
1
vote
2 answers

Is there an Android function similar to php include()

am a php coder who's relatively new to Android programming and I was just wondering....I have a few functions which recur in every activity. Normally in php, I would put all these recurring functions in a file functions.php and include in each php…
Biko
  • 332
  • 3
  • 15
1
vote
0 answers

Allow to include a script but prevent file system access to it

related to the search I seem to have a rather unpopular problem. I have a server running Plesk and multiple customers set up with a separate web space for each (no ssh access). Further there is a "main" script repository which I put outside the…
koani
  • 61
  • 1
  • 4
1
vote
1 answer

Another PHP include issue

I've gone through the archives and read a bunch of questions relating to why PHP include won't work. I've tried to fix my problem using answers to the other questions, but am still having issues. This is my code:
1
vote
0 answers

%%Include{ }%%Error accessing windows share through a Java application

I developed a Java application which gives access to shared folders from the Network. Scenario The application I am accessing includes a search field. I am accessing the file using the following code: try { File file = new…
mustangDC
  • 945
  • 1
  • 12
  • 33
1
vote
1 answer

PHP include/require: Prevent fallback in path resolution

As helpfully stated in the documentation for include(): If the file isn't found in the include_path, include will finally check in the calling script's own directory and the current working directory before failing. Is there any setting to…
1
vote
1 answer

Php include_once and absolute paths

I'm trying to write a PHP app and right now I'm having trouble with the include_once() method. I have a folder structure like this: /home/header.php /home/index.php /home/admin/admin.php I have no problem accessing header.php from index.php…
DidierFuentes
  • 87
  • 2
  • 17
1
vote
3 answers

PHP include / undefined variable

I am aware there are more topics on this matter, I've read them, but I did not found the answer. I have an index.php, that contains a bunch of .php includes: header.php, navigation.php, box.php, footer.php, and inside the "pages" div, I have the one…
VVG
  • 13
  • 2