The directory needs to be owned by the same user as the PHP process is running. If you're using PHP under apache, this user will generally be apache.
You can check this by checking the user of httpd:
[user@host ~]$ ps aux | grep httpd
You will get an output similar to this:
[user@host ~]$ ps aux | grep nginx
root 4774 0.0 0.3 11204 3288 ? Ss 12:20 0:00 /usr/sbin/httpd
apache 4776 0.0 0.1 11204 2076 ? S 12:20 0:00 /usr/sbin/httpd
apache 4777 0.0 0.1 11204 2076 ? S 12:20 0:00 /usr/sbin/httpd
apache 4778 0.0 0.1 11204 2076 ? S 12:20 0:00 /usr/sbin/httpd
apache 4779 0.0 0.1 11204 2076 ? S 12:20 0:00 /usr/sbin/httpd
apache 4780 0.0 0.1 11204 2076 ? S 12:20 0:00 /usr/sbin/httpd
apache 4781 0.0 0.1 11204 2076 ? S 12:20 0:00 /usr/sbin/httpd
apache 4782 0.0 0.1 11204 2076 ? S 12:20 0:00 /usr/sbin/httpd
apache 4783 0.0 0.1 11204 2076 ? S 12:20 0:00 /usr/sbin/httpd
root 4787 0.0 0.0 5500 716 pts/1 S+ 12:20 0:00 grep httpd
Here I am running apache with PHP compiled as a module, so changing the permissions to 'apache' will fix your problem and allow you to reset permissions to 755 or 700 if you're really security conscious:
[user@host ~]$ chown apache /path/to/upload/dir
[user@host ~]$ chmod 755 /path/to/upload/dir
As per your comment, you could add apache
and psacln
to the same group, change group ownership and chmod it that way
[user@host ~]$ sudo groupadd web
[user@host ~]$ sudo usermod -G web apache
[user@host ~]$ sudo usermod -G web psacln
[user@host ~]$ chgrp web /path/to/upload/dir
[user@host ~]$ chmod 070 /path/to/upload/dir
You could also use 575 for rwr permission (owner, group, other)