Testing a php file for school with fopen() function, which does not work because of... permission issues?
I'm using Ubuntu in my laptop.
Every time I turn it on, and after Ubuntu initializes, it ask me for my admin password, wich I do provide, in order to be able to use it.
I've installed Sublime2, and I'm learning my first steps in PHP/MySQL
I'm using this ubuntu laptop at my programming class.
Today, we needed to do some fopen() tests for the first time.
I created a file and added to it this code:
error_reporting(E_ALL ^ E_NOTICE);
fwrite($fp, 'Curso de PHP');
Now, when I try to run the file (I'm using Xampp as my local apache, and I'm using chrome as my browser), I getthis error (and the file is not created at all):
Warning: fopen(prueba.txt): failed to open stream: Permission denied
in /opt/lampp/htdocs/curso_php1/inicial/ejemplo-archivos.php on line
Warning: fwrite() expects parameter 1 to be resource, boolean given in
/opt/lampp/htdocs/curso_php1/inicial/ejemplo-archivos.php on line 26
Warning: fclose() expects parameter 1 to be resource, boolean given in
/opt/lampp/htdocs/curso_php1/inicial/ejemplo-archivos.php on line 27
When at my home, I've tried the code again, in my windows macine, and everything worked as expected, without any errors.
It seems as I don have enough permissions (failed to open stream: Permission denied), why is that?
Why is this happening? What should I do? Thanks!"