simplexml issues

im created a small script to gather browser data for a site.  im using PHP5 and SimpleXML.

if i view:  http://www.antons-law.com/properties2/browser-stats.php  it works fine, displays blank page (as page will be executed in the background) and saves your browser name, version etc in an XML file.

however if i try include my browser-stats.php page in another file, say index.php i get the following error:

Fatal error: Call to undefined function: simplexml_load_file() in /home/ukpegasu/public_html/antons-law/properties2/browser-stats.php on line 10

I dont understand what is wrong or why is brakes...?  please help.
index.php
=====================
<?php
include_once('browser-stats.php');
?>
 
browser-stats.php
=====================
 
<?php
$browser = array();
$browser = get_browser(null, true);
 
$name = $browser['browser'];
$version = $browser['version'];
$platform = $browser['platform'];
$users = 1;
 
$xmlobj = simplexml_load_file('browser-stats.xml');
 
$query = '/browsers/browser[@name="'.$name.'"][@version="'.$version.'"][@platform="'.$platform.'"]';
 
$entries = $xmlobj->xpath($query);
 
if(count($entries) == 1)
{
	$attributes = $entries[0]->attributes(); 
	$attributes->users = $attributes->users + 1;
}
else
{
	$browserobj = $xmlobj->addChild('browser');
	$browserobj->addAttribute('name',$name);
	$browserobj->addAttribute('version',$version);
	$browserobj->addAttribute('platform',$platform);
	$browserobj->addAttribute('users',$users);
}
 
$xmlobj->asXML('browser-stats.xml');
?>
 
browser-stats.xml
===============================
 
http://www.antons-law.com/properties2/browser-stats.xml

Open in new window

LVL 16
ellandrdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
What version of PHP are you running?

Also, (off topic) you might want to look at this page in Firefox - the navigation is broken on "Properties"
http://www.antons-law.com/

0
ellandrdAuthor Commented:
im using PHP5.  

Yes i know.  i've still to redesign that side of the site.  but first i need to get the properties side of things working first....  ;-)
0
Ray PaseurCommented:
Sorry - I read too fast - PHP5.

Simple XML should be there by default: http://us.php.net/manual/en/simplexml.installation.php

I'll do a little more digging! ~Ray

0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

ellandrdAuthor Commented:
Yes I know. Both the local server  and live server have PHP5.  All works fine locally but as soon as i FTP, it dies...

Im also looking at the documentation incase i see any clues but nothing yet!
0
Ray PaseurCommented:
Run this on the server and post the (painfully lengthy) output!
<?php phpinfo(); ?>

Open in new window

0
ellandrdAuthor Commented:
0
Ray PaseurCommented:
Thanks - can't see anything wrong there.  Have you raised this with BlueHost?  Their support is usually pretty good.

Also, can you post the code for these scripts so I can install on my server?  I will be glad to make a mirror test for you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ellandrdAuthor Commented:
Attached my files... rename .txt to .php  (EE wont allow .php or a ZIP file containing .php)  HOPE YOUR READING THIS EE PROGRAMMERS - VERY ANNOYING!

You got Browscap enabled?  If not then just use dummy data for browser name, version.... you'll see what i mean!

btw, i've just changed my script to use:

$xmlobj = new SimpleXMLElement($xmlstring);

and still no luck!
ellandrd.zip
0
Ray PaseurCommented:
Looking at this message...

Fatal error: Call to undefined function: simplexml_load_file() in /home/ukpegasu/public_html/antons-law/properties2/index.html on line 13

I wonder if there is something about parsing PHP at issue here.  Could the include statement somehow be looking at an older version of PHP or a different library?
0
ellandrdAuthor Commented:
Mmmm.  Ray you might be right.  I'm just looking at the error logs and this is what i get:

However If i look in my php.ini file (unedited and provided to me by bluehosts) i dont have the extension php_domxml.dll uncommented so it shouldnt be working...right?

in my cPanel on bluehost i can see the PHP version enabled and it shows PHP 5.5.6..... i have PHP5.5.6 installed locally too.
[28-Oct-2008 07:12:16] PHP Warning:  Unknown(): Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:12:16] PHP Fatal error:  Call to undefined function:  simplexml_load_file() in /home/ukpegasu/public_html/antons-law/properties2/index.html on line 13
[28-Oct-2008 07:13:10] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:13:11] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:13:11] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:15:28] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:15:28] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:15:28] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:18:06] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:18:07] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:18:07] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:24:17] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:24:17] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:24:18] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:27:03] PHP Warning:  Unknown(): Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:27:03] PHP Fatal error:  Call to undefined function:  simplexml_load_file() in /home/ukpegasu/public_html/antons-law/properties2/index.html on line 13
[28-Oct-2008 07:29:18] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:29:18] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Oct-2008 07:29:18] PHP Warning:  PHP Startup: Unable to load dynamic library './php_domxml.dll' - ./php_domxml.dll: cannot open shared object file: No such file or directory in Unknown on line 0

Open in new window

0
Ray PaseurCommented:
Make sure your error_log is not full and set error_reporting(E_ALL) - you can sprinkle in some var_dump() statements and it's worth testing the return from all your functions.

In unrelated news, you can post PHP files in to the code snippet.  Normally I avoid opening any zip files - at least from unfamiliar posters!
0
Ray PaseurCommented:
That helps.  Seeing the log, I'd say the next step is here:
http://helpdesk.bluehost.com/help

0
ellandrdAuthor Commented:
>>In unrelated news, you can post PHP files in to the code snippet.  

As i said EE wont allow me post the .php file extension so you will have to copy and paste my code from above then.

>>Normally I avoid opening any zip files - at least from unfamiliar posters!

cant argue with that....
0
Ray PaseurCommented:
Yeah, I understand about the PHP file extension.  Seems like it could be automatically converted to something unparseable like .phpFIleText, eh!
0
DarkFishCommented:
Well, firstly you're on a Linux box so a .dll will not work. You would need to use the Linux equivalent of the dll; however in this case you shouldn't need to.

On BlueHost the domxml ext. is compiled into PHP; you don't need the extension=php_domxml.dll in your php.ini.

Try commenting it out and see if your script works, which it should. :)
0
ellandrdAuthor Commented:
DarkFish

I ahve already mentioned that i do not have this line commented in.  The PHP.ini file that i was given by bluehost has not been changed.
0
ellandrdAuthor Commented:
im chatting live to bluehost support but getting no where....  why do they hire guys to support PHP when the guys have no idea.....
0
Ray PaseurCommented:
Because they're cheap.  Tell them to escalate the problem - don't waste time with the phone jockeys.
0
ellandrdAuthor Commented:
now they have replaced my default php.ini file with a new one which has broken the php_browscap.ini file......
0
Ray PaseurCommented:
Can you tell me more about browscap? Or post the code?
0
Ray PaseurCommented:
Nevermind - for some reason I have never seen get_browser() D'OH>
0
ellandrdAuthor Commented:
browscap is just a database containing browser info.

http://uk2.php.net/get_browser
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.