Hello,
Ive been working through code show in the book ‘Learning PHP, MySQL, & JavaScript’ by Robin Nixon, in which he creates a social media site.
When trying to upload a file, I receive the following errors:
**Warning** : move_uploaded_file(xarth.jpg): failed to open stream: Permission denied in **/opt/lampp/htdocs/social_media/profile.php** on line **34**
**Warning** : move_uploaded_file(): Unable to move '/tmp/phpPKTrhf' to 'xarth.jpg' in **/opt/lampp/htdocs/social_media/profile.php** on line **34**
After reading posts about file/folder permissions, I changed the php.ini file to:
upload_tmp_dir="/opt/lampp/htdocs/social_media/upload/"
However, even after restarting Apache and MySQL servers, the error persists. phpinfo shows the updated file path.
Also, echo sys_get_temp_dir();
returns /tmp, so I am a bit confused as it seems that three folders are involved.
[EDIT] PHP is running as user daemon, which is the owner with read & write access to lampp/temp. I still cannot find the /tmp folder, even after searching the lampp directory. Well, there were tmp folders but for docs and phpmyadmin.
Any help would be appreciated,
Thank you.