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

how to include a php file that already includes another file?

I am trying to include 2 php file in two separate tags in the same table. Both the php files include another php file for connecting to a database (eg.
1
vote
0 answers

Adding PHP file as a panel in Wordpress and execute with parameters

I'm going to create a php file with 2 loan calculators inside. This file should be included as a panel like [panel name="calculator-main"]. On the Home Page, file should display both calculator interfaces. On other pages - just a single…
Besik
  • 43
  • 7
1
vote
1 answer

PHPUnit cannot find source code

I have a PHP project, with the following project structure. php_test_app src Vegetable.php tests StackTest.php VegetableTest.php The code of these files is shown below. I use PDT and PTI in Eclipse. PHPUnit in…
physicalattraction
  • 6,485
  • 10
  • 63
  • 122
1
vote
4 answers

Including PHP files doesn't work in Cron PHP Scripts (Ubuntu VPS)

I am using Ubuntu 14.04 X64. I am setting up a basic Cron job with crontab -e: * * * * * /usr/bin/php /var/www/html/test/test.php >> /var/www/cron/cron.log This is /var/www/html/test/test.php: And…
vinsanity555
  • 241
  • 1
  • 11
1
vote
2 answers

PHP not passing variable

I've encountered a rather weird problem that has me completely stumped. I'm trying to pass a PHP variable from one file to another, then plug that variable into a search function within the Flickr API. To put in context, it's pulling a variable…
jmariano
  • 35
  • 7
1
vote
1 answer

include two PHP files in one html file is not working

I have two php files which are doing some database work so i want to show them on single page so i created an html file and include both of the php files, this methods work well every time i use but not working now, please help to solve. Both file…
1
vote
1 answer

Embedding A Googlemap via PHP include statement

I have created a custom google map to display my business branches, (which is stored in a file called [map-locations].php. When i open this file in a browser the file displays perfectly, however if i try to include this php file using an include…
cj69
  • 71
  • 1
  • 1
  • 2
1
vote
0 answers

How to print the full PHP code generated right before compile (after includes and requires)?

Is there a way to print full php (in php) code after includes and requires? For example I have 3 files. File basic.php File basic2.php and the main file main_file.php
Grego
  • 2,220
  • 9
  • 43
  • 64
1
vote
2 answers

Limit scope of require'd class definitions to a function

I have folder with many plugins. Each plugin contains same name class but different content: plugin01.php class Plugin{ public function get($a){ return 'Plugin01 - '.$a; } } plugin02.php class Plugin{ public function get($a){ return…
m1k1o
  • 2,344
  • 16
  • 27
1
vote
0 answers

PHP Require/Include SSL

I am working on migrating an apache webserver to include SSL. I have installed the certificates, and am able to utilize Https without issue. The webpage also have a database component. this works without error in the standard Http version. When I…
user1874538
  • 262
  • 2
  • 15
1
vote
4 answers

Php Error - Unexpected require_once expecting function

I'm currently trying to fetch the medoo framework so that I can begin easily retrieving data from my MySQL database... and for some reason it doesn't work! here's the code of my signin.php file
muffinjello
  • 158
  • 1
  • 5
  • 16
1
vote
1 answer

Included PHP page doesn't execute code

I have some code that's working on my server and when I put it up to a different server (both CentOS, Apache), the includeed file doesn't execute the code. So I get the following: Main file
Don Rhummy
  • 24,730
  • 42
  • 175
  • 330
1
vote
1 answer

How to automatically load classes without debug_backtrace()

I've written a little system that automatically loads classes from the same directory in which it's located the file who require that class.
1
vote
5 answers

Ways to include a page in PHP and replace all the variables in it?

For example, I have a page called 'include.php' or 'include.html', which contains the following lines of code:

Hi {$yourname}, this is a header.

Now, I want to include this page using PHP on another page, let's say on 'index.php'…
user3382146
  • 59
  • 1
  • 5
1
vote
1 answer

Including a file in multiple directories - PHP

I am trying to get my include() functions in order but everytime I switch the syntax in one directory it messes up its subdirectory and vice versa. I have a file called 'header.php' in my 'localhost/FTS/includes/header.php' folder. The 'FTS'…