The user ID (UID) under which your PHP and CGI scripts run depends on your web hosting environment and how the server is configured.
Here’s how it usually works:
Â
 Shared Hosting (like 4GoodHosting)
On shared hosting environments like 4GoodHosting, your scripts generally run under:
🔹 Your Own User Account
-
Both PHP and CGI scripts typically run as your hosting account’s user, not as the global
nobody
orapache
user. -
This is achieved through server modules like:
-
suPHP (for PHP)
-
CGIwrap or suEXEC (for CGI scripts)
-
This setup ensures:
-
Improved security – Scripts can’t interfere with other users.
-
File ownership consistency – Uploaded files are owned by your user account.
Â
🔹 How to Check the Running User
You can create and run a small test script to find out.
For PHP:
Create a file named whoami.php
:
For CGI (Perl example):
Create a file whoami.cgi
:
Make sure it’s in your cgi-bin
, and has 755
permissions.
Â
🛑 In Some Other Environments:
-
If mod_php is used (less common now), scripts may run as
nobody
orapache
. -
On dedicated/VPS servers, you have more control and can configure this.
Â
✅ Summary:
Script Type | User ID (Shared Hosting) | Notes |
---|---|---|
PHP | Your hosting username | via suPHP or PHP-FPM |
CGI | Your hosting username | via suEXEC or CGIwrap |
If you’re using 4GoodHosting and need confirmation for your specific plan, I can guide you how to check or interpret cPanel server settings.