W
W
whiteoverlord2015-01-22 19:07:27
PHP
whiteoverlord, 2015-01-22 19:07:27

PHP 5.5 require doesn't work, what's wrong?

There is a cloud VPS. Ubuntu 14 + LAMP with latest updates.
I transfer a script to it (which works on a different hosting and locale) with the following structure of includes:
/engine/dbcfg.php - require -> /engine/cfg.php
/engine/inc/functions.php - require_once -> /engine /ini.php
/engine/inc/smarty_libs/Smarty.class.php- require_once -> /engine/ini.php
/engine/cfg.php - include_once -> /index.php
/engine/ini.php - include_once -> /index.php
In general, the bottom line is that the files are included normally, there are no errors that the file is not found.
But the variables that are included from other files are not visible.
For example, variables from dbcfg.php are not visible in cfg.php. When you try to display them on the screen, it displays blanks.
I'm not particularly good at Unix, very basic. What can be wrong?
Cat to attract attention:
9de431ce65b348558f0f479c947afb90.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Damir Makhmutov, 2015-01-22
@doodoo

To attract attention, the cat should have been at the beginning of the topic :-)
But in the case - most likely you need to do it (which is highly discouraged) like this:

// dbcfg.php
$firstVar = "test";

// cfg.php
global $firstVar;
var_dump($firstVar);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question