I recently installed php, but when I was unable to save files, I was very stuck, and that’s why I’m posting it here, I want to tell anyone who Googles this problem to find this solution.
The problem was when I used an fopen and fsave within php, the file would always ‘die’ as in the open or die within php. The solution is below
Firstly I looked for the Environment user in phpinfo() in my case it was
and then I simply typed this
[box type=”shadow”]chmod 777 -R www-data /var/www[/box]
that, in its simplicity is the solution, but I am thankful that I have found the solution!
To create a phpinfo you need to create a file in your root and insert the following code
and save it as phpinfo.php or whatever you choose, I saved it in my root but you can save it wherever you want, then I browsed to the environments section and that gave me the necessary information for me to create the solution.
Why this works
The problem was that php did not have enough permissions to write to the folder. by giving the user www-data full permission i.e. 777 it can now read write and execute without a problem!
A habit worth looking into is to structure your hard-drive and here is some notes.
Your hard-drive root (C:) should just be folders, nothing else, and it shouldn’t have any of YOUR folders that you keep stuff in that your not sharing on a network, thats what your user folder is for.
Share folders on a drive root. Long names for files will eventually fill the limit and you cant store anything, so I keep all my shared folders in root in organised folders, but don’t clutter your HDD, it should be a thing of beauty, not a baron list of folders and files, just files. (To clarify, I mean you should only have folders on your C: nothing else)
Have a C:/Store folder and a C:/Drivers folder, C:/Store is for stuff you need but don’t want, like pesky programs that wont live in Program Files. and C:/Drivers is for all the installers for your computer from your manufacturers website.
Why go to all this trouble? Well its good practise I suppose.
I have my computer for multiple reasons, editing, video production, gameing, rendering and general use, because of that I have a very high spec computer and it’s great, but today I want to talk about the joys of excessive HDD space.
First of all, I dont have a SSD, and I dont plan on getting one, but they seem great, so I may consider it, please stop commenting on this subject, I am fully aware of the Joys of SSDs. my server has a 30GB one and it is great, but please, no more spam.
So first, whats it good for? Well currently I have 3 HDDs and they are setup with no raid, but I do have VSS running which is great, but heres a bullet pointed list.
Previous Versions, A vital backup tool.I have this on Alfie (My harddrive name), this is connected to the computer via USB so its slower, and therefore I use it for bvackups and archiveing stuff rather than storage.Its great!, when your computer dies, you cant help but feel a bit down hearted, but with this, you just hit F8 a bunch of times, select your date and your done, but it can take some time if your backup was a while ago, so do it regularly, or set it to an interval.
Windows Image Backup or File History, its like backup, but you can restore Individual files so if you deleted a folder, you can just roll it back I have used this a few times and its really saved me. I over use this to, deleted something you shouldn’t?, ‘is it in the recycle bin, no, hmm just roll back the folder, ah there it is.’ . Also on Alife.
Store all the things. I have Felix for this, a swifty SATA HDD, I haven’t deleted anything in a while I keep all my songs, video and Pictures on it and its great. I also keep software and Installers on there incase my software breaks.
RAID. I dont have this, but its worth pointing out RAID would be useful, but Id rather use all the space :).