-2

I'm using Mac OSX, and when I try to create a temporary file, I get this message:

$temp_file  =  tmpfile();

Could not create temporary files for attachments. Your tmp directory may be unwritable by PHP

I checked the directory, and here's what I see:

echo sys_get_temp_dir();

ls -ld /var/folders/v1/9BmtDyVv7v15d6qx07_4ylfh0000gn/T
drwx------  41 mark  staff  1394 Feb 21 12:44 /var/folders/v1/9BmtDyVv7v15d6qx07_4ylfh0000gn/T
Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
redolent
  • 4,159
  • 5
  • 37
  • 47
  • 4
    you dont have write permissions set for the directory `drwx------`, only the user `mark` does – Patrick Evans Feb 21 '14 at 19:53
  • 4
    This question appears to be off-topic because the error message in combination with the output should be more enough to help you help yourself. – PeeHaa Feb 21 '14 at 19:54

1 Answers1

2

Are you sure you're mark ?

<?php var_dump(get_current_user()); // will probably display www-data

If, as I guess you are, you're executing this script with a web-server, keep in mind the web server is probably run by another user than you (which is a security best practice), even if the startup script is run by root.

greg0ire
  • 22,714
  • 16
  • 72
  • 101