apicard80 0 Newbie Poster

I have a situation where I am updating a config file and I need a following include('config.php') to pick up the latest version of the file.

Presently what I am getting is that the include picks up the previous version that had been included earlier.

Here the scenario
index.php:

<?php
include_once('inc1.php');
...
include('inc2.php');
?>

inc1.php:

<?php
	$fname = 'inc2.php'; 
	require($fname);
	
	$handle = fopen($fname, 'w');
	fwrite($handle, "<p><?php echo 'in inc2 - written on ".date('Y-m-d H:i:s:u')." - now it is '; echo(date('Y-m-d H:i:s:u'));"."?></p>\n");
	fclose($handle);
?>

and in inc2.php (original):

<h1><?php echo 'in inc2'; ?></h1>

so what you have is that the first include_once of inc1 forces the include of inc2, which then gets updated. But when back in the main page, the include of inc2 now just brings the version that was loaded at the top of inc1, not the updated version.

Thanks,
Alain