Re: DOM File Permissions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PHP needs read/write access to the files. More than likely PHP is running as Apache so the files would need to be owned by Apache* (or whatever PHP is running at), not System.

*Or at least give the Apache group (or whatever PHP is running at) r/ w access, that way you don't have to resort to world r/w.

On Mar 7, 2007, at 1:55 PM, CK wrote:

The following code returns a permisson error:

Quote:
Warning: DOMDocument::save(./save1.xml) [function.DOMDocument- save]: failed to open stream: Permission denied in /Users/username/ Sites/xmlphp/dom/appendData/appendData.php on line 17
DOMCharacterData->appendData example

I attempted changing the owner of each file to System and read/ write for each file, with the same result, MAC OS 10.4.8, without success, what steps are needed to correct this?

This source returned for the remote server(http://bushidodeep.com/ php/dom/appendData/appendData.php):
<b>DOMCharacterData->appendData example</b>



<?php

$doc = new DomDocument;
//Load the xml file into DOMDocument
$doc->Load('./employee.xml');
//We retreive the attibute named id of the employee element
$employee = $doc->getElementsByTagName('employee')->item(0);
//Create a New element
$newElement = $doc->createElement('surname');
//Create a text node
$textNode = $doc->createTextNode("Text Node Created");
//Append the Text Node into the newly created node.
$newElement -> appendChild($textNode);
//Append the new element to the employee element
$employee -> appendChild($newElement);
//Save the DOMDocument into a file.
$test = $doc->save("./save1.xml");
echo "<b>DOMCharacterData->appendData example</b>"
?>

Return True,

.........
PHP
Version 5.1.4

MySQL
Client API version 5.0.19
..........

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux