Do you have apc installed and enabled? If so, you'll have to clear its cache too. Call apc_clear_cache()
or tell it to re-compile the updated file
apc_compile_file("/filepath/filename.php");
Pergunta
I just upgraded to Ubuntu 14.04 and php5.5.9 and am having an issue with some old code.
This is probably something simple but is driving me crazy!
Boiled down, here is the issue:
I can't figure out why php is including the OLD file, not the newly written file.
Note: the file IS written correctly by php. But the OLD file is included, not the new one. If I hit browser refresh, the new values appear.
The variable file is written with php tags because I wrote it a long time ago. Not sure if I need to change it.
filename.php
<?php
$yesorno = "no";
?>
samplefile.php
include "/filepath/filename.php";
$opencar = '<';
$closecar = '>';
$fh = fopen("/filepath/filename.php", 'w') or die("can't open file");
fwrite($fh, $opencar."?php\n");
fwrite($fh, "\$yesorno = \"yes\";\n");
fwrite($fh, "?".$closecar."\n");
fclose($fh);
include "/filepath/filename.php";
echo "result: $yesorno";
execute samplefile.php
result: "no"
(refresh browser) result: "yes"
Looking at filename.php
directly, it is immediately written correctly. Just not called correctly with the include.
What I've done:
php.ini:
allow_url_fopen = On
allow_url_include = On
restarted apache
tried various forms of clearstatcache
This code works perfectly on older version of php
.
Something obvious? Any help would be appreciated!
Solução
Do you have apc installed and enabled? If so, you'll have to clear its cache too. Call apc_clear_cache()
or tell it to re-compile the updated file
apc_compile_file("/filepath/filename.php");