1

I am currently working on a project that writes to a file based on your input. This works perfectly fine on my localhost, but when I try this project on my college server - it just doesn't work.

$ret = file_put_contents('paameldinger.dat', $data, FILE_APPEND | LOCK_EX);

This line is supposted to return true, but returns false on the college server.

Warning: file_put_contents(paameldinger.dat): failed to open stream: Permission denied

This is the message I am getting through my browser.

u_mulder
  • 54,101
  • 5
  • 48
  • 64
HalfClimb
  • 11
  • 1
  • 2
  • file_put_contents need write permission on that folder https://stackoverflow.com/questions/10990/what-are-the-proper-permissions-for-an-upload-folder-with-php-apache – nithinTa Nov 13 '17 at 04:29
  • Do you have Linux/Apache server or a Windows/IIS? – wp78de Nov 13 '17 at 04:36

1 Answers1

1

You have to make sure that you have permission to access the file paameldinger.dat

STEP 1 If you are on linux, you can check it by:

ls -l

command from the directory of the file (on windows you may use CMDER editor to execute the above command).

STEP 2: You can change the permission of the file by:

chmod 777 paameldinger.dat
Lukas
  • 610
  • 7
  • 16
Victor1224
  • 11
  • 1