Brownie

Well-Known Member
Aug 10, 2001
143
0
316
If you've got SuEXEC installed, just chmod the file to 755 and put a shebang at the top - should run PHP as that user :)

#!/usr/bin/php
&?php
.......
 

shaun

Well-Known Member
PartnerNOC
Verifed Vendor
Nov 9, 2001
702
1
318
San Clemente, Ca
cPanel Access Level
DataCenter Provider
Twitter
well the reason for running the script as the user is so that the script cannot be read by others mainly. 0750 should work if 0755 does... I hope, i'll try this out. Thanks.

reason for 0750 is so that people cannot read a php file that has passwords in it for the people wondering.
 

gordita

Well-Known Member
Aug 14, 2001
113
0
316
yes, running PHP as a CGI script would allow the script to be run under the users uid/guid since you are using SuExec, but if you want to run mod_php (or mod_perl) scripts under a specific UID/GID your best (only) plan is to create a seperate httpd instance for this user - this provides the strictest security although it does require some manual configuration and you probably don't want to create a ton of these individual user specific httpd processes.