Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-18-2010, 09:14 AM
|
#1
|
Member
Registered: Jul 2005
Location: England
Distribution: 2.6.15-1.2054_FC5
Posts: 35
Rep:
|
PHP Functionality
Hello,
I'm sure I'm doing something rather silly but I cannot work out what is going on. I have recently downloaded and installed Fedora 14 on my server. I am trying to write some PHP. I cannot however, get some of its functionality to work.
Here's an example: SimpleXmlElement. I read that it is part of the core PHP package and thus no 'import'/'include'/etc. is needed. However, on my server, using Firefox 3.6.12, the webpage just crashes on the line
Code:
$x = new SimpleXmlElement($content);
and I get no output afterwards.
Running it in the command prompt I get, what looks like, the correct output, but with these added warnings, which I don't understand:
Code:
PHP Warning: SimpleXMLElement::__construct(): Entity: line 8: parser error : Entity 'raquo' not defined in includes/functions.php on line 7
PHP Warning: SimpleXMLElement::__construct(): <title>Nettuts+ » We are making some changes!</title> in includes/functions.php on line 7
PHP Warning: SimpleXMLElement::__construct(): ^ in includes/functions.php on line 7
PHP Warning: Invalid argument supplied for foreach() in includes/functions.php on line 11
I have used the code provided here:
http://net.tutsplus.com/demos/08_RSS...eeds/index.php
I know it works as I've tried it on another server successfully. My first thought was that that it maybe some configurations in httpd.conf, but I am not sure.
I'm rather confused! Any help would be greatly appreciated.
Thanks in advance,
The Godfather
|
|
|
11-18-2010, 09:31 AM
|
#2
|
Member
Registered: Oct 2010
Location: México
Distribution: Centos
Posts: 72
Rep:
|
Quote:
Originally Posted by The Godfather
Hello,
I'm sure I'm doing something rather silly but I cannot work out what is going on. I have recently downloaded and installed Fedora 14 on my server. I am trying to write some PHP. I cannot however, get some of its functionality to work.
Here's an example: SimpleXmlElement. I read that it is part of the core PHP package and thus no 'import'/'include'/etc. is needed. However, on my server, using Firefox 3.6.12, the webpage just crashes on the line
Code:
$x = new SimpleXmlElement($content);
and I get no output afterwards.
Running it in the command prompt I get, what looks like, the correct output, but with these added warnings, which I don't understand:
Code:
PHP Warning: SimpleXMLElement::__construct(): Entity: line 8: parser error : Entity 'raquo' not defined in includes/functions.php on line 7
PHP Warning: SimpleXMLElement::__construct(): <title>Nettuts+ » We are making some changes!</title> in includes/functions.php on line 7
PHP Warning: SimpleXMLElement::__construct(): ^ in includes/functions.php on line 7
PHP Warning: Invalid argument supplied for foreach() in includes/functions.php on line 11
I have used the code provided here:
http://net.tutsplus.com/demos/08_RSS...eeds/index.php
I know it works as I've tried it on another server successfully. My first thought was that that it maybe some configurations in httpd.conf, but I am not sure.
I'm rather confused! Any help would be greatly appreciated.
Thanks in advance,
The Godfather
|
I could be a problem with your php version. What version does it have the server where you tried it?
What version does it have your computer?
Made a simple test.php page with this content:
<?php phpinfo();?>
And compare the output between that server where it works and your computer.
Regards
|
|
|
11-18-2010, 09:50 AM
|
#3
|
Member
Registered: Jul 2005
Location: England
Distribution: 2.6.15-1.2054_FC5
Posts: 35
Original Poster
Rep:
|
Hi fcintron,
Quote:
Originally Posted by fcintron
What version does it have the server where you tried it?
|
PHP Version 5.2.6-1+lenny8
Quote:
Originally Posted by fcintron
What version does it have your computer?
|
5.3.3
|
|
|
11-23-2010, 06:11 AM
|
#4
|
Senior Member
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552
Rep: 
|
Why not try something simpler, like the suggested phpinfo() call, or even
Code:
<?php
echo "Hello World!";
?>
If you see this, your PHP instance IS working in the first place. If it is, you can start debugging further from there what might be wrong about the other code that you originally posted.
|
|
|
11-24-2010, 10:01 AM
|
#5
|
Member
Registered: Jul 2005
Location: England
Distribution: 2.6.15-1.2054_FC5
Posts: 35
Original Poster
Rep:
|
Hi Ryan,
Thanks for your help.
Quote:
Originally Posted by rylan76
Why not try something simpler, like
Code:
<?php
echo "Hello World!";
?>
|
This returns "Hello World!". The PHP installation is working. I have written code, setup forums, wikis etc. but for some reason, I can't get the above code to work. It seems to work on the command line, i.e. when i execute:
I'm so confused.
|
|
|
11-25-2010, 04:35 AM
|
#6
|
Senior Member
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,466
|
Hi
Can you post the XML file you are trying to parse? From the error message it looks like it's not proper XML. This is incorrect:
Code:
<xml>
<title>Nettuts+ » We are making some changes!</title>
</xml>
This is correct:
Code:
<xml>
<title>Nettuts+ » We are making some changes!</title>
</xml>
Try to open the XML file in some browser and see if you get any errors.
I also got XML parse errors upgrading PHP to the newer versions. It seems the older versions allowed many weird XML files, whereas the newer versions are more strict.
For example, some XML files coming from some .NET application had the prefix <?xml version="1.0" encoding="unicode"?>. It was actually UTF-16LE and older versions of PHP would parse it, but not the newer ones. After changing the prefix to <?xml version="1.0" encoding="UTF-16"?> they parsed fine.
|
|
|
All times are GMT -5. The time now is 05:07 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|