I have all my pages on website in PHP. There are few issues with databases and with my hosting company. That is the reason if number of users are more than certain limit at a time then website wont show and show error messages.
What I want to do is to get all php pages and convert into html automaticaly and save as html on the server. So everytime when some data is updated on my website I will take php pages convert them into html pages and then save it.
In that way I can save number of database connections because users can view html pages databases. I got plenty bandwidth so should be ok for me on doing this.
I got this script from somewhere but it wont work for me and give me error messages.
<?php
$files = file("filelist.txt");
for($i = 0; $i < count($files); $i++) {
ob_start();
include ($files[$i]);
$page = ob_get_contents();
ob_end_clean();
if(strpos($files[$i], ".php") > -1) {
$file = fopen(substr($files[$i], 0,strlen($files[$i])-4) . ".html",'w');
fputs($file, $page);
fclose($file);
}
}
?>
Can you please help me how can i get my objective. Is there better way to do this. Or how can I implement this. thanks
The error messages on this script I am getting are,
"Warning: main(index.php ): failed to open stream: No such file or directory in /mnt/w0401/d04/s45/b0225e10/www/test/dynamic.php on line 5
Warning: main(index.php ): failed to open stream: No such file or directory in /mnt/w0401/d04/s45/b0225e10/www/test/dynamic.php on line 5
Warning: main(): Failed opening 'index.php ' for inclusion (include_path='.:/usr/local/nf/lib/php') in /mnt/w0401/d04/s45/b0225e10/www/test/dynamic.php on line 5
"
I am very stuck so any suggestion will be great.