To find any virtual hosts, which may use alternate users, groups, or both, check the configurations. For Red Hat based distributions it would be usually its user running httpd is apache :. I know that this is an old post, but it is still listed as unanswered, so I will make a suggestion. If you can't find which user or group Apache is running as, perhaps try opening the httpd. There should be an entry there for "User" and "Group".
Not only can you see which user Apache is supposed to be running as, but you can change it if you feel the need to do so. This code will - more or less - alphabetically list all the non-root users running processes containing apache or whose name contains apache. If you want to get fancy, you can suppress errors if the file is not found, and provide a default value:. As suggested by Noyo here :. I found most of the solutions offered here are system- or configuration- specific in particular, most of the solutions do not work at all on MacOS and a few rely on the user knowing where Apache's configuration files are in the first place The simple command apachectl -S will tell you what you need to know about a running instance of Apache, and its results can be parsed fairly easily.
Here's my solution, which I use at the top of a few bash scripts to determine a variety of things I might need at any given time Use lsof and pass the port apache is listen to as an argument. See the USER column for the user appache is running as. I found this command in CakePHP docs. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Learn more. Finding out what user Apache is running as? Ask Question. Asked 11 years, 7 months ago. Active 1 year, 9 months ago. Open Apache 's configuration file using your preferred text editor. Find User and Group directives in Apache 's configuration file. Set the value to existing user and group that you want Apache process to run as. User root Group root The following example is to run it as root and is a big security risk as an exploited script will have full access to the system.
Make sure the configured user and group has the correct permission to the folder. Restart Apache service. Installation failed. The corresponding Install log shows the following errors: OpenAM Web Agent for Apache server silent installation license accepted with --acceptLicence option license was accepted earlier Unable to find the "User" entry in the httpd.
Solution This issue can be resolved as follows: Check whether the user and group are set; you can do this via the httpd. For example: Review the httpd. Within the child process each request is handled by a separate thread.
MaxRequestsPerChild : Like the Unix directive, this controls how many requests a single child process will serve before exiting. However, unlike on Unix, a single process serves all the requests at once, not just one. If this is set, it is recommended that a very high number is used.
The recommended default, MaxRequestsPerChild 0 , causes the child process to never exit. ThreadsPerChild : This directive is new. It tells the server how many threads it should use. This is the maximum number of connections the server can handle at once, so be sure to set this number high enough for your site if you get a lot of hits.
The recommended default is ThreadsPerChild The directives that accept filenames as arguments must use Windows filenames instead of Unix ones.
However, because Apache uses Unix-style names internally, you must use forward slashes, not backslashes. Drive letters can be used; if omitted, the drive with the Apache executable will be assumed. Apache for Windows contains the ability to load modules at runtime, without recompiling the server.
To activate these or other modules, the new LoadModule directive must be used. For example, to activate the status module, use the following in addition to the status-activating directives in access.
Information on creating loadable modules is also available. More information is available. When running CGI scripts, the method Apache uses to find the interpreter for the script is configurable using the ScriptInterpreterSource directive.
Since it is often difficult to manage files with names like. This mechanism acts as a backup for those situations where Apache cannot even access the normally used error. Apache can be run as a service on Windows NT. There is some highly experimental support for similar behavior on Windows 9x. You can install Apache as a service automatically during the installation. If you chose to install for all users, the installation will create an Apache service for you.
If you specify to install for yourself only, you can manually register Apache as a service after the installation. You have to be a member of the Administrators group for the service installation to succeed. Apache comes with a utility called the Apache Service Monitor. With it you can see and manage the state of all installed Apache services on any machine on your network. To be able to manage an Apache service with the monitor, you have to first install the service either automatically via the installation or manually.
You can install Apache as a Windows NT service as follows from the command prompt at the Apache bin subdirectory:. If you need to specify the name of the service you want to install, use the following command. You have to do this if you have several different service installations of Apache on your computer.
If you need to have specifically named configuration files for different services, you must use this:. Before starting Apache as a service by any means, you should test the service's configuration file by using:. You can control an Apache service by its command line switches, too. To start an installed Apache service you'll use this:. You can also restart a running service and force it to reread its configuration file by using:.
By default, all Apache services are registered to run as the system user the LocalSystem account. It has, however, wide privileges locally. You may want to create a separate account for running Apache service s. Especially, if you have to access network resources via Apache, this is strongly recommended. If you allow the account to log in as a user and as a service, then you can log on with that account and test that the account has the privileges to execute the scripts, read the web pages, and that you can start Apache in a console window.
0コメント