[off-topic]
When you post code in the forum, you need to format it. To do so you can either select all the code and click the </> button, or type 3 backticks ``` on a separate line both before and after the code block.
Have you tried checking what’s in $xml after you have loaded it from the file, using var_dump() or similar? If I try a version of your code using simplexml_load_string it works.
Why don’t we start with the basics before speculating too much. Let’s see if the function is telling us what is wrong. (simplexml_load_file will throw E_WARNING for each XML error found.)
Fatal error: Uncaught Error: Call to undefined function simplexml_load_file() in /mnt/base/www/chesstao/test-1.php:10 Stack trace: #0 {main} thrown in /mnt/base/www/chesstao/test-1.php on line 10
LIne 10:
$xml=simplexml_load_file("note.xml") or die("Error: Cannot create object");
This only fails in localhost, it works perfectly at http://chesstao.com/test-1.php
How can I fix this? I changed the permissions to 755 at web site of test-1.php and note.xml as well as the localhost versions of those files. But it still fails at localhost.
If your script tells you: Call to undefined function, that means either extension failed or you use namespace and should to call \simplexml_load_file() (with backslash).
What shows your phpinfo()? There should be information about libxml.