Problem in File Handling in PHP

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Problem in File Handling in PHP

Postby KS_Sahil » 21. July 2014 10:37

Hi Guys!

I am using Ubuntu 12.04 and in that I have installed XAMPP 1.8.2-5.
When I am doing the file handling in PHP, the new file (by using fopen()) is not created. I don't know why but it says permission denied to open the file.
At first I thought this is the issue of root permission. But even after logging in as root, it is not working.
Please suggest some way to overcome this problem.

Thanks in advance!
KS_Sahil
 
Posts: 1
Joined: 21. July 2014 10:25
Operating System: Ubuntu

Re: Problem in File Handling in PHP

Postby Nobbie » 21. July 2014 10:47

KS_Sahil wrote: But even after logging in as root, it is not working.


Of course not.

Your own login and/or UserID is not relevant for Apache and PHP, Apache is a system process which runs under a certain UserID, which is determined by the option "User = ...." in httpd.conf. As PHP runs as module under Apache, it runs with the same UserID.

Obviously, this UserID does not have sufficient rights to create a new file in the desired folder. Thats all - you have to change the rights of the folder (via "chmod") or change the ownership of that folder (via "chown") in order to allow Apache/PHP to create files.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 24 guests