Hi,
I have PHP code that been in production server for many years and it works fine.
The production server is solaris 8 Apache/2.0.36 (Unix) PHP/4.2.1.
I built a new server.This is solaris 9 Apache/2.0.49 (Unix) PHP/4.3.6 DAV/2 .
I used the same code as in the production server.Everything works fine except they couldn't create the needed xls file.
Thereisn't any problem with permission or incompatible version whatsoever as i tried a small code to create xls file and it works fine.
I thought it must be problem with PHP so i overwrite the current php with version 4.3.4. The new server now becomes
Solaris 9 Apache/2.0.49 (Unix) PHP/4.3.4 DAV/2 .
Now I'll be able to create the xls file but i have the following warning msg displayed on website and the html created is 0 kb (it is supposed to be a few hundreds Kš.
allow_url_fopen() it is on safe_mode is off. Check permission and everything...it looks seems right.
Please help.
HEre is the parital code and the error msg
Note that the same code is still running well on the production server.
Thanks
Code:
if (isset($POST['save']))
{
$faulttotalsbystate = urlencode(stripslashes($POST['faulttotalsbystate']));
$graphs = urlencode(stripslashes($POST['graphs']));
$report_id = urlencode(stripslashes($POST['report_id']));
$tmp = "http://${SERVER['SERVER_NAME']}:${SERVER['SERVER_PORT']}${_SERVER['PHP_SELF']}?static=$faulttotalsbystate&graphs=$graphs&report_id=$report_id";
$temp_report = fopen ($tmp, "r");
$static_html_name = "${_SERVER['DOCUMENT_ROOT']}/reports/static/lat/lat_report_" . $monday_date . ".html";
$static_html = fopen ($static_html_name, "w");
fwrite ( $static_html, fread($temp_report, 300000) );
fclose( $static_html );
fclose( $temp_report );
header("Location: [url]http://[/url]${_SERVER['SERVER_NAME']}:${_SERVER['SERVER_PORT']}/reports/static/lat/lat_report_" . $monday_date . ".html");
exit;
}
else
{
session_start();
}
Error:
Warning: fopen(http://cmmpro.optus.com.au:8081/php/view_temp_report.php?static=a%3A4%3A%7Bs%3A3%3A%22NSW%22%3Bi%3A1656%3Bs%3A3%3A%22VIC%22%3Bi%3A1072%3Bs%3A3%3A%22QLD%22%3Bi%3A409%3Bs%3A3%3A%22NAT%22%3Bi%3A3137%3B%7D&graphs=a%3A24%3A%7Bi%3A1%3Bd%3A0.01299524893698863703406232161796651780605316162109375%3Bi%3A3%3Bd%3A0.011262549078723484985431468885508365929126739501953125%3Bi%3A6%3Bd%3A0.12787324953996817011869779889821074903011322021484375%3Bi%3A2%3Bd%3A0.0453967362865469770127901938394643366336822509765625%3Bi%3A7%3Bd%3A0.02651030783145682079293692368082702159881591796875%3Bi%3A11%3Bd%3A0.0674020244865143869361645556637085974216461181640625%3Bi%3A14%3Bd%3A0.2261173315036022923862901734537445008754730224609375%3Bi%3A10%3Bd%3A0.013515058894468181538428552812547422945499420166015625%3Bi%3A5%3Bd%3A0.01247543897950909030925004117307253181934356689453125%3Bi%3A9%3Bi%3A0%3Bi%3A4%3Bd%3A0.0055446395464484847792618893436156213283538818359375%3Bi%3A8%3Bd%3A0.05440677554952575434299433254636824131011962890625%3Bi%3A15%3Bi%3A0%3 in /usr/local/apache2/htdocs/php/view_temp_report.php on line 17
Warning: fread(): supplied argument is not a valid stream resource in /usr/local/apache2/htdocs/php/view_temp_report.php on line 20
Warning: fclose(): supplied argument is not a valid stream resource in /usr/local/apache2/htdocs/php/view_temp_report.php on line 22
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/apache2/htdocs/php/view_temp_report.php:17) in /usr/local/apache2/htdocs/php/view_temp_report.php on line 23