in reply to Re^3: Preferred Windows Perl?
in thread Preferred Windows Perl?

I'm trying to solve the problem of autostart from CD without installation using XAMPP. I can't get apache.exe to start in the background, e.g. the script always waits. I am about to try Strawberry Perl and Win32::Process, but I would much rather use the perl that comes with XAMPP and find another way. I was wondering if the last poster would share his solution --Gerry

Replies are listed 'Best First'.
Re^5: Preferred Windows Perl?
by mr_mischief (Monsignor) on Feb 10, 2009 at 17:36 UTC
    I did use the Create() method for Win32::Process to start Apache in the background. Be sure you're using the flags CREATE_NO_WINDOW and DETACHED_PROCESS (or'ed together, like so:
    CREATE_NO_WINDOW|DETACHED_PROCESS
    so that the whole call looks similar to:
    my $apache_obj; Win32::Process::Create( $apache_obj, "\\ws\\server\\Apache\\Apache.exe", "apache -f $apache_dir\\httpd.conf", 0, CREATE_NO_WINDOW|DETACHED_PROCESS, "." ) || die "Starting webserver: $!\n";
    There are some other things to think about like how you get the working directory set up, where your Apache config will be, whether it all stays on the CD or if you use a temporary directory, and a few more issues. Using the proper flags should get your process detached and windowless, though. See the Win32::Process documentation for even more flags. You might want to cross-check those against some Microsoft docs, too, but I don't recall exactly where those docs are.