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 1428 ak1dnar 1,584
Recognized Expert Top Contributor
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 to
connect from a remote location using:
mysql -h xxx.xxx.xxx.xxx -P 3306 -u root -p mysql
I get:
ERROR 2003: Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061)
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 with Sablotron 1.0) with
the following:
Warning: Sablotron error on line 1: XML parser error 4: not well-formed
(invalid token) in /...host...path.../page.php on line 28
FAILURE : XML parser error 4: not well-formed (invalid token) ; error
|
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 file, reopen it, and then have an error message in
task list: "\\xxx\wwwroot$\xxx\xx.aspx.cs(68): The variable
'configurationAppSettings' is either undeclared or was never assigned"
I open the code-behind file, and find out the trouble spot at the...
|
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 GridView control, each with its
own SqlDataSource. FormView1 talks to my Opportunity table and has an
ItemTemplate and an EditItemTemplate. FormView2 talks to my Activities table
and has an ItemTemplate, InsertItemTemplate and an...
| |
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 the following Connection string
var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Data.mdb";
Search of Data.mdb on the desktop.
I came to know that this requires absolute path i.e
var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data
|
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 = document.getElementById('hometab');
Has anyone ever seen anything like this before, or am I dreaming?
|
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 Python CGIs
(non-Zope). Unfortunately, my web host does not have mod_python. They
only way I can run a python script is by using the .cgi extension. I'm
not sure if I want to stick with my host and just call my apps
index.cgi, or if I should move to a...
|
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:
http://www.torusdesign.nl/spry/test.php?folder=schilderijen/vrij_werk&navColor=SchilderijenNAV
This is the code:
<?php echo $folder; ?>
<?php echo $navColor; ?>
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |