first - I don’t recommend running scripts by php with sudo, because as you said yourself, you don’t have much knowledge of linux, and that would be a huge loophole not only in your application but in your entire S.O..
2º - You could create a folder with global permission for everyone to access, so I believe employee for you mkdir("directorname", 0777);
More information about linux permissions in the link below
http://www.infowester.com/linuxpermissoes.php
3º - You can execute any command in the operating system with the exec or shell_exec
Some more permissions data below:
--------- 000
r-------- - 400
r-r-r-- 444
rw-------- 600
rw-r-r--- 644
rw-rw-rw- 666
rwx------- 700
rwxr-x--- 750
rwxr-Xr-x 755
rwxrwxrwx 777
What did you try to do? What error did you make? If you put this part of the script it’s easier for someone to help you.
– Pedro Lorentz
Welcome to Stack Overflow! Please explain the problem better, and if possible include a example of code that reproduces what is happening, because your question is too wide. See Help Center How to Ask.
– Jorge B.
You should explain whether you are running your PHP on the terminal or on the webserver
– gpupo