Hi,

I have the following situation;
I made a website where I can manage the pages. One option, where I add more pages, is giving me problems.

When working on my localhost everything works perfectly, and the generated file is being processed correctly. Online however is results in a very poor result

My code to generate

$link = 'test.php';               
$f = fopen($link, "w+");
/* content php file */
$line .= '<?php
    /* pagina */
    $pagenum = \''.$newnum.'\';
       
    /* include het hoofdonderdeel dat overal gelijk is */
    include(\'ins_header.php\');
   
?>
    <div id="contentcontainer" class="floatleft">
        <div id="contentaligner">
            <div id="contenttitel" class="floater">
                <?php echo $titel; ?>
            </div>
            <div class="floater">
                <?php
                    /* aanroepen content */
                    if($pagenum) echo request_content($pagenum);
                ?>
            </div>
        </div>
    </div>
<?php
    /* include het voetonderdeel dat overal gelijk is */
    include(\'ins_footer.php\');
?>';
fwrite($f, $line);
fclose($f);

the generated file is correct. When I pull it of the server it is also the way it should be. Localhost makes the PHP do its magic with the includes en function, online I get this result

<div id="contentcontainer" class="floatleft">
	<div id="contentaligner">
		<div id="contenttitel" class="floater">
						</div>
		<div class="floater">

Now the funny thing is, when I pull the file from the server and upload that exact same file back to the server... it works

So... why does my PHP file generated on the server not work, except when I reupload is manually?

edit:

also tried writing (w+) in an excisting and online working php file. And then copying copy(excisting, new) this file with its new name. Then both file stopped functioning

after generating file, set its permission to 777 (just to check whether permission issue or not).

after generating file, set its permission to 777 (just to check whether permission issue or not).

CHMOD settings are auto on 644, like on every other file.

Just added

chmod($filename, 0777);

and checked on server. Now its 777. Still same result

Its strange

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.