[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: starting apache with -X



Le 11.03.2014 13:25, Reco a écrit :
Hi.

On Tue, Mar 11, 2014 at 12:41:03PM +0100,
berenger.morel@neutralite.org wrote:
Hello.

I am trying to debug a cgi script run through apache, and have found
some documents which says that running apache with -X allows to not
run apache as a daemon [1].
But, I do not really understand how to do this: I start it with
commands like this one: "#service apache2 start/stop/restart/...". I
tried to go inside /etc/rc2.d/S01apache2 ( yes, I know, it's only a
link to real script ) but...
410 lines of shell script are not that easy to understand when you
are not accustomed to.

1: https://httpd.apache.org/dev/debugging.html
I know it's about debugging apache, and not CGIs, but I hope to be
able to find how to break with gdb when apache starts my script
after this.

You don't need to modify apache start scripts for this. Just do this
instead:

service apache2 stop

/usr/sbin/apache2 -X

Reco

Well, it was not exactly this procedure ( I did not replied in time, I had other things to do in the meantime ).

In fact, to run apache with -X, I had to:
_ edit /etc/apache2/envvars to uncomment the line "#export APACHE_ARGUMENTS=''" and insert -X into the '
_ run, as root, apache with "#apache2ctl start"

Simply running "/usr/sbin/apache2 -X" will not work, because the envvars file is like a shell environment, which fills some variables that you need in order to initialize correctly apache's configuration. This file is used by apache2ctl, which is, AFAIK, started by apache2 when you use #services apache2 start".

And this is not easy to find on the web, I guess I should write it in some wiki dedicated to Debian.


Reply to: