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
chmod 777 -R www-data /var/www
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
<?php // Show all information, defaults to INFO_ALL phpinfo(); ?>
and save it as
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!
here is what php looks like when you do phpinfo
you can check a file exits and is editable with this code http://stackoverflow.com/a/13297218
Now you’ve finished you can celebrate! here is a song (this is mainly so I can test embedding :P)