1

Since I updated my MAC's OS (to the latest, OSX Mavericks) I noticed, that there was no content on my page (it's a php project with much code).

But the point is, that the problem occurs every time I try to load an XML file via Simplexml.

Here's the code:

$file = __DIR__ . '/myfile.xml';
$xml  = simplexml_load_file($file);

But there is no error, it's just an empty page (no HTML source to see in the browser). And I didn't turn error reporting off. And the path is also correct (is_file() returns true).

And like I said, before the OS update it worked well.

hakre
  • 193,403
  • 52
  • 435
  • 836
Leo
  • 1,508
  • 13
  • 27
  • "I didn't turn error reporting off" - but did you turn it **on**? If this is a fresh install of PHP, your php.ini probably got over-written. – IMSoP Oct 24 '13 at 21:15
  • possible duplicate of [Reference - What does this error mean in PHP?](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) (in particular [this section](http://stackoverflow.com/a/12772851/157957)). – IMSoP Oct 24 '13 at 21:15
  • I think that error reporting is still on, because if I make the path wrong by adding an extra folder in between who doesn't exist it throws the exception about the wron path... I also added `ini_set('display_errors', 1); error_reporting(~0);` but didn't changed anything – Leo Oct 24 '13 at 21:33
  • Don't guess, verify instead. Especially as this is not within the first five minutes of debugging. Also if you downgrade the OS again (or restore the backup), does it work again? – hakre Oct 30 '13 at 08:41
  • Installing all latest OS X updates from App Store and rebooting fixed issue for me. – Anton Rybalko Jan 21 '15 at 21:23

2 Answers2

2

I had the same problem after updating to Mavericks. When I try to call simplexml_load_file the page crashes. I used $content = file_get_contents($xml); $config = new SimpleXMLElement($content); instead of simplexml_load_file and it helped me.

thumbtackthief
  • 6,093
  • 10
  • 41
  • 87
Evgen
  • 21
  • 2
  • If I might make a recommendation - instead of calling `file_get_contents` then `new SimpleXMLElement` (which would use roughly twice the amount of memory), rather make use of the `$data_is_url` argument. So: `$config = new SimpleXMLElement($xml, 0, true)` – garbetjie Oct 30 '13 at 19:50
1

My Mac is doing the same thing after updating to Mavericks. The httpd service is actually crashing whenever I call simplexml_load_file, so no php errors ever get generated. Check /Library/Logs/DiagnosticReports/ for error logs. I haven't found a fix yet.

Updating to XAMPP Mac OS X 1.8.3 PHP 5.5 fix this issue for me. http://www.apachefriends.org/en/xampp-macosx.html