This topic is locked

Problem with "include"

3/6/2025 3:14:14 PM
PHPRunner General questions
M
Mauipm author

HI,
I'm going crazy with a problem related to include of a php file (global.php) containing a simple function, used for testing purposes.

In the "After application initialized" event I inserted, at the beginning:

include_once("global.php");

the global.php file is in the root of the application. it contains the simple function:
<?php
function timezone_used() {
$x= "TIMEZIONE USED: " .date_default_timezone_get();
return $x;
}
?>

Locally everything works perfectly (in the past I've used many complex php files inclusion, without problem in local but never working on-line)

Online, instead, after inserting:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

to get some messages, I get these errors

Warning: Undefined array key "ODBCString" in /home/customer/www/kesira.it/public_html/test_usa_getta/connections/Connection.php on line 60
Warning: Undefined array key "password" in /home/customer/www/kesira.it/public_html/test_usa_getta/include/appsettings.php on line 932
Warning: Undefined array key "runnerSession" in /home/customer/www/kesira.it/public_html/test_usa_getta/classes/security.php on line 2385
Warning: Cannot modify header information - headers already sent by (output started at /home/customer/www/kesira.it/public_html/test_usa_getta/global.php:14) in /home/customer/www/kesira.it/public_html/test_usa_getta/include/phpfunctions.php on line 2907

Has anyone had the same problem in the past? Suggestions?
Many thanks for you attention

Mauro

Sergey Kornilov admin 3/6/2025

The first few warning suggest that you use a newer version of PHP on the server while your project was built with an older version of PHPRunner. Probably not important but recommended to rebuild the project using the latest version of the software.

The include file problem suggests that you have some whitespace in that global.php file after the closing ?>. Make sure that there are no spaces or empty line after ?> in that file.

M
Mauipm author 3/7/2025

Thanks for the suggestions.
PHP versions are very similar:

  • PHP: 8.2.12 in local
  • PHP Version 8.2.27 online

I managed to get the include to work online, but only by removing the login.
I tried to re-build the same application with login even just with hardcoded mode and the error reoccurs.

P.S.: I'm using PHPRUNNER 10.91-build 41242

Mauro

M
Mauipm author 3/10/2025

I imported the project into phprunner11-build 43060, and the error continues to appear:

  • everything works locally: XAMPP Version: 8.2.12
  • blank page without warnings or online errors, if the application requires login; the login mask does not appear either, and the commands: ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1); error_reporting(E_ALL), at the beginiing of after_app_init, do not produce any error.

Does anyone have the same problem?
Mauro