0

I'm on Mac OS X High Sierra, running Apache 2.4.33 and PHP 5.6.31. I've tried everything in this post (and some other posts on the same problem):

move_uploaded_file gives "failed to open stream: Permission denied " error after all configurations I did

I have encountered endless problems with the solutions presented, and could not find any solutions to those minor problems as well.

  1. Making changes to php.ini does not change anything in phpinfo.php, it's like the changes don't commit. So I can't try if changing the temp directory works.
  2. I changed the permissions for /private/var/tmp but could not change for /private or /var even using sudo in the terminal. (I broke sudo while trying to do so.)
  3. According to echo exec('whoami') my apache user is _www and is the same with what is specified in httpd.conf, however according to the Terminal command ps aux | egrep '(apache|httpd)' it is iremkaki. ps aux | grep httpd returns this:

     _www       1128   0.0  0.0  4404384   4156   ??  S    11:51AM   0:00.03 /usr/sbin/httpd -D FOREGROUND
    
     root       1124   0.0  0.1  4385924  11232   ??  Ss   11:51AM   0:00.38 /usr/sbin/httpd -D FOREGROUND
    
     iremkaki   1237   0.0  0.0  4276968    892 s000  S+    1:28PM   0:00.00 grep httpd
    
     _www       1130   0.0  0.0  4394116   1032   ??  S    11:52AM   0:00.00 /usr/sbin/httpd -D FOREGROUND
    
     _www       1129   0.0  0.0  4403104   3336   ??  S    11:51AM   0:00.03 /usr/sbin/httpd -D FOREGROUND
    
    1. Yes, I restarted my server after each solution trial, still didn't work

      Any guidance?

edit: problem solved, but I have no idea why. I just gave up for the day, shut down computer, the next morning I opened localhost and it was working. Huh.

  • 1
    `Making changes to php.ini does not change anything in phpinfo.php` So are you editing the `php.ini` that is mentioned in `phpinfo()` output `Loaded Configuration File` That the `php.ini` that is being used by php under Apache – RiggsFolly Aug 13 '18 at 10:34
  • Also look in `phpinfo()` output for `upload_tmp_dir` thats the directory that files are stored in by PHP and where it `moves` then from in a `move_uploaded_files()` – RiggsFolly Aug 13 '18 at 10:38
  • @RiggsFolly yes I am. At first I was editing a different php.ini but now I'm sure it's the correct one – İrem Kaki Aug 13 '18 at 10:39
  • @RiggsFolly `upload_tmp_dir` in `phpinfo()` has no value. – İrem Kaki Aug 13 '18 at 10:40
  • So why are you trying to change the permissions on `/private/var/tmp` – RiggsFolly Aug 13 '18 at 10:42
  • I am not a MAC user but I seem to remember that the normal place for the tmp data is something like `/tmp/something_relevant` try setting the `upload_tmp_dir` in `php.ini` to something sensible like that and make sure that your `_www` account has the relevant access to it – RiggsFolly Aug 13 '18 at 10:46
  • @RiggsFolly apparently `/private/var/tmp` is the default and I'm sure that that's the temp folder because the error gives the temp file name as well, and there is a file of that exact same name in that directory. No I can't set anything from `php.ini` as I've told in the question. I change something, I save `php.ini` but those changes aren't reflected in `phpinfo.php` . Something is not working there. – İrem Kaki Aug 13 '18 at 10:57
  • @İremKaki After changing php.ini you have to restart your webserver for these changes to have any effect. If that still doesn't work your definetly editing the wrong php.ini – Xatenev Aug 13 '18 at 11:55
  • @Xatenev I did restart my server, several times in fact... – İrem Kaki Aug 15 '18 at 12:13

0 Answers0