by ozental_uk » 05. September 2004 11:17
Well I tried installing Apache and mySQL as a service and again, Apache sticks after 'x' hours. Currently I am trying an automatic scheduled event to restart Apache every 1 hour and so far, it looks promising. If you are having problems with Apache hanging after 'x' hours, you might want to try this:
1. Install Apache as a service.
2. Create an MS-DOS patch file that does:
cd\xampp\apache\bin
apache -n "service name" -k restart
3. Schedule it to run every hour.
=======================================================
Here's other info I collected from the Net:
Controlling Apache in a Console Window
You can tell a running Apache to stop by opening another console window and running:
apache -k shutdown
Note: This option is only available with Apache 1.3.3 and later.
For earlier versions, you must use Control-C in the Apache console window to shut down the server.
From version 1.3.3 through 1.3.12, this should be used instead of pressing Control-C in a running Apache console window, because it allowed Apache to end any current transactions and cleanup gracefully.
As of version 1.3.13 pressing Control-C in the running window will cleanup Apache quite gracefully, and you may use -k stop as an alias for -k shutdown. Earlier versions do not understand -k stop.
You can also tell Apache to restart. This makes it re-read the configuration files. Any transactions in progress are allowed to complete without interruption. To restart Apache, run:
apache -k restart
=======================================================
To start Apache as a service, you first need to install it as a service. Multiple Apache services can be installed, each with a different name and configuration. To install the default Apache service named "Apache", choose the "Install as Service for All Users" option when launching the Apache installation package. Once this is done you can start the "Apache" service by opening the Services window (in the Control Panel, hidden in "Administrative Tools" on Windows 2000), selecting Apache, then clicking on Start. Apache will now be running, hidden in the background. You can later stop Apache by clicking on Stop. As an alternative to using the Services window, you can start and stop the "Apache" service from the command line with
NET START Apache2
NET STOP Apache2
See Controlling Apache as a Service for more information on installing and controlling Apache services.
Apache, unlike many other Windows NT/2000 services, logs most errors to its own error.log file, in the logs folder within the Apache server root folder. You will find few Apache error details in the Windows NT Event Log. Only errors as Apache attempts to start are captured in the Application Event Log.
After starting Apache as a service (or if you have trouble starting it) you can test it using the same procedure as for running in a console window. Remember to use the command:
apache -n "service name"
to assure you are using the service's default configuration
=============================================================
Select Apache from the Control Panel's Service dialog and click Startup.
Verify that the service account is correct. You may wish to create an account for your Apache services.
Retype the password and password confirmation.
Go to User Manager for Domains.
Click on Policies from the title bar menu, and select User Rights.
Select the option for Advanced User Rights.
In the drop-down list, verify that the following rights have been granted to the selected account:
Act as part of the operating system
Back up files and directories
Log on as a service
Restore files and directories
Confirm that the selected account is a member of the Users group.
Confirm the selected account has access to all document and script directories (minimally read and browse access).
Confirm the selected account has read/write/delete access to the Apache logs directory!
=============================================================
Controlling Apache as a Service
Multiple instances of Apache can be installed and run as services. Signal an installed Apache service to start, restart, or shutdown/stop as follows: apache -n "service name" -k start
apache -n "service name" -k restart
apache -n "service name" -k shutdown
apache -n "service name" -k stop
For the default "Apache" service, the -n Apache option is still required, since the -k commands without the -n option are directed at Apache running in a console window. The quotes are only required if the service name contains spaces.