[PLUG] PHP include problem

michael michael at robinson-west.com
Mon Dec 11 18:37:56 UTC 2017


root at raspberrypi:/var/www# cat test.php
<?php
include 'variables.php';

echo "Settings.config: $settings_config";
echo "Local IP: $localIP";
?>
root at raspberrypi:/var/www#

root at raspberrypi:/var/www# cat variables.php
<!-- Author: Michael Robinson -->
<!-- Early attempt to centralize paths to one file -->
$localIP = '127.0.0.1';

$settings_config        =realpath('/opt/apex/etc/settings.config');
$prog_tcp_client        =realpath('/opt/bin/tcp_client');
$prog_udp_client        =realpath('/opt/bin/udp_client');
$tps_files_dir          =realpath('/opt/apex/tps_files');
$path_boxes_config      =realpath('/opt/apex/etc');
$path_connectedBoxes_dat=realpath('/opt/apex/var/connectedBoxes.dat');
$stateFile              =realpath('/opt/apex/var/current_state.dat');
$boxFile                =realpath('/opt/apex/etc/boxes.config');
root at raspberrypi:/var/www#

root at raspberrypi:/var/www# php test.php
<!-- Author: Michael Robinson -->
<!-- Early attempt to centralize paths to one file -->
$localIP = '127.0.0.1';

$settings_config        =realpath('/opt/apex/etc/settings.config');
$prog_tcp_client        =realpath('/opt/bin/tcp_client');
$prog_udp_client        =realpath('/opt/bin/udp_client');
$tps_files_dir          =realpath('/opt/apex/tps_files');
$path_boxes_config      =realpath('/opt/apex/etc');
$path_connectedBoxes_dat=realpath('/opt/apex/var/connectedBoxes.dat');
$stateFile              =realpath('/opt/apex/var/current_state.dat');
$boxFile                =realpath('/opt/apex/etc/boxes.config');
PHP Notice:  Undefined variable: settings_config in /var/www/test.php on 
line 4
Settings.config: PHP Notice:  Undefined variable: localIP in 
/var/www/test.php on line 5
Local IP: root at raspberrypi:/var/www#

Any thoughts on what I need to change to make test.php work?



More information about the PLUG mailing list