I've got a php page which is outputing xml to a file.
The code has been working without a hitch for weeks when running as localhost, but a few days ago I uploaded it to my ec2 instance, and it doesn't seem to work.
the data is stored in $xml_output, and I've added the "echo xml_output" at the bottom of the page to see what the page is holding.
I can see that both servers are accessing the correct data from the
echo $name, $genre, etc. that I have put throughout the page.
On local host, echo $xml_output spits out the full page stream. on ec2, that is empty, even though the other variables along the way have not been.
File opens fine, sql connection isn't the issue, it seems that the xml_output is either being cleared or never adding the elements. VERY STRANGE
anybody seen this issue before with variable values not working? or disappearing?
Here is a subsection of the code. -
$fh = fopen($m3xmlFile, 'w') or die("can't open file");
-
-
$xml_output = "";
-
$xml_output .= "<cache>\n";
-
-
while (list($key, $value) = each($y)) {
-
//Output the array key/value
-
$genreName = htmlentities($key, ENT_NOQUOTES);
-
$xml_output .= "\t<genre>\n";
-
$xml_output .= "\t\t<id>$value</id>\n";
-
$xml_output .= "\t\t<name>$genreName</name>\n";
-
$xml_output .= "\t</genre>\n";
-
}
-
-
-
while($rowa = mysql_fetch_array($resulta, MYSQL_ASSOC))
-
{
-
-
$name = htmlentities($rowa['name'], ENT_NOQUOTES);
-
$specialCharReplace = array("´", "§", "±", "—", "«", "„", "‚", "¸", "ˆ", "˚", "…", ",,", "Š", "â", "‰", "ˆ", "‡", "Œ", "˜", "¨", "&heart;", "¢", "²", "¸", "¶", "©", "™", "¬", "·", "¾", "¯", "¡", "¤", "³", "¥");
-
$name = str_ireplace($specialCharReplace, "", $name);
-
$name = str_replace("ƒ", "", $name);
-
$name = str_replace ("Ã", "A", $name);
-
-
$xml_output .= "\t<artist>\n";
-
$xml_output .= "\t\t<id>". $rowa['bid'] . "</id>\n";
-
$xml_output .= "\t\t<name>". $name . "</name>\n";
-
echo $name.'<br />';
-
// do genre math
-
-
$genre = str_replace("/", "|", $rowa['genre']);
-
echo $genre.'<br />';
-
$gSplit = array();
-
$gSplit = explode("|", $genre);
-
$gSplit = array_unique($gSplit);
-
print_r (array_unique($gSplit));
-
$numarray = array();
-
foreach($gSplit as $gString) {
-
$genrenum = @$y[trim($gString)];
-
echo $genrenum.'<br />';
-
-
array_push($numarray, $genrenum);
-
$numarray = array_unique($numarray);
-
$genreTotal = array_sum($numarray);
-
-
echo $genreTotal.'<br />';
-
}
-
$xml_output .= "\t\t<genre>". $genreTotal ."</genre>\n";
-
-
$xml_output .= "\t</artist>\n";
-
}
-
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
-
{
-
-
$xml_output .= "\t<song>\n";
-
$xml_output .= "\t\t<id>". $row['sid'] . "</id>\n";
-
$xml_output .= "\t\t<data>". $row['mipid'] . "</data>\n";
-
$xml_output .= "\t\t<artist>". $row['bid'] . "</artist>\n";
-
$xml_output .= "\t\t<popularity>".$row['plays']."</popularity>\n";
-
// if ($row['genrenum'] != "0"){
-
// $xml_output .= "\t\t<genre>". $row['genrenum'] ."</genre>\n";
-
// } else {
-
// $xml_output .= "\t\t<genre></genre>\n";
-
// }
-
$xml_output .= "\t</song>\n";
-
}
-
-
$xml_output .= "</cache>";
-
-
echo $xml_output;
-
-
fwrite($fh, $xml_output);
-
fclose($fh);
-
-
2 1398
What is the operating system on your hosting server? is it same as your local server OS? I think this problem is occurs because of the line breaks. waiting for your response.
The host is linux and my os is windows,
but this ended up being a configuration limiting the available file size that php can create on the host.
I added -
-
ini_set("memory_limit","100M");
-
to the top of the page to get over the memory limit.
Hope fully somebody can find this useful in the future.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ryan Stewart |
last post by:
I'm running MySQL server on a WinXP box at home. I have a cable
modem/router. I've set up port forwarding on port 3306 to the machine
running MySQL. I can connect locally just fine, but when I try...
|
by: Martin Plantec |
last post by:
Hello,
I have managed (with your help!) to make a working XSLT stylesheet; it
works fine locally (Windows Apache + PHP with Sablotron 1.0), but it
fails on the remote host (FreeBSD Apache + PHP...
|
by: claus.hirth |
last post by:
Does the term 'host variable' cover a variable locally declared in a
SQL-PL stored procedure?
I am asking this question in the context of the SELECT INTO statement.
|
by: hui |
last post by:
Here is a problem I am having with web form designer. I have a database
control in the form, and setup the connection string as a dynamic
property. It compiles and runs fine.
I close the aspx...
|
by: Michael Glass |
last post by:
I'm working on an ASP.Net web app using VS2005 and the .Net 2.0 framework,
and I have a serious problem with the page I'm currently working on. The page
has, among other things, two FormViews and a...
|
by: mhadi |
last post by:
Hi All,
I am developing a solutions for clients to run some webpages. Since
there is no webserver the ASP route is a No Go. So I am using
Javascript to connect to my database.
The Problem is that...
|
by: weston |
last post by:
I've got a piece of code where, for all the world, it looks like this
fails in IE 6:
hometab = document.getElementById('hometab');
but this succeeds:
hometabemt =...
|
by: Ben Wilson |
last post by:
I've had the same web host (imhosted.com) for the past three years, and
have had decent service. However, I'm also trying to learn Python the
hard way--by doing. So, I figured I'd write a few...
|
by: Bob Bruyn |
last post by:
I've recently installed Apache 2 and php 5.2 on my WIndows XP
machine. Everything is up and running.
I'm passing some vars via the URL. It works fine online:...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| | |