|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
File And Directory Manipulation In PHP (part 1)
File And Directory Manipulation In PHP \(part 1\)
PHP comes with a powerful and flexible file manipulation API that allows developers (among other things) to read and write files, view and modify file attributes, read and list directory contents, alter file permissions, and retrieve file contents into a variety of native data structures. Find out more, inside. Discuss this article in this thread. You can read the article here . |
|
#2
|
||||
|
||||
|
I'm curious about the permissions settings for file writing. When I am trying to create a file in a subfolder and write to it I have to set that folder's permissions to full access. Otherwise I get errors from php telling me that I don't have permission.
Any thoughts? Travis |
|
#3
|
||||
|
||||
|
Yes that is because PHP runs as the user the webserver runs as, either nobody or apache. The user the webserver runs as need to have permission to write to the folder, hence why you need to chmod the file as 777
|
|
#4
|
||||
|
||||
|
I did find this thread:
http://forums.devshed.com/t76052/s.html About half way down they begin talking about setting up permissions for a group so that you dont have to chmod 777. I haven't played with it yet, but I thought someone else might see this and find it useful. Travis |
|
#5
|
|||
|
|||
|
Disk drives like c:\ or d:\ or e:\ are part of reality when it comes to novices dealing with pathnames in doing file and directory manipulation with php in windows.
I did not see any mention of drive letters in any of the path examples. I did not see any discussion of problems a novice might encounter with a pathname like d:/foo/boo/file.txt Without this - I do not think part 1 and part 2 will allow a novice to manipulate files or directories of interest. Or is it just me? |
|
#6
|
||||
|
||||
|
Thanks for this great article.
I have however one question that nobody can seem to help me with, I've posted a few times on various forums: How can I read apart of a .txt file(by checking for tags) and then copy that part to another new .txt file ? Attached is a .txt I want to read. PHP must break the file each time it reads a <sender> tag, and write the report to a new file that's going to be emailed. PLEASE HELP ME ON THIS AS I'M STRUGGLING WITH THIS FOR 4 WEEKS NOW thanks in advance
__________________
:P
|
![]() |
| Viewing: Dev Shed Forums > Other > Development Articles > File And Directory Manipulation In PHP (part 1) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|