2006-01-06, 05:45 PM
OK, here's a bit of background on what I'm trying to do. I need to show someone a PHP/MySQL powered website (built and tested in Linux) without uploading to a server. The only system I can get to is a laptop running Windows XP Pro, and I don't want to boot a live Linux distro.
I have installed Apache/PHP/MySQL on this laptop and they are talking to each other OK. What I want to build is a short batch script that will start MySQL, and then Apache and then launch a browser to view automatically without fumbling around in the CLI. I am running Apache *not* as a service. Here is my code so far:
Code:
@echo off
echo Now starting test server, please wait...
echo.
echo.
echo.
rem pause
echo Starting database server...
echo.
net start mysql
rem pause
echo.
echo Starting web server...
echo.
"C:\Program Files\Apache Group\Apache2\bin\apache.exe"
pause
echo.
echo Now loading Internet Explorer to show the page...
rem pause
echo.
"C:\Program Files\Internet Explorer\iexplore.exe" "http://127.0.0.1:8080"
echo.
echo The server is now started, please go to your Internet Explorer window to view the page
echo.
echo.
echo.
echo ===========================================================
echo To stop the servers, please press any key.
echo (Apache must be stopped manually by closing the CMD window)
echo ===========================================================
pause>nul
echo.
echo Stopping database server...
echo.
net stop mysql
echo.
echo Done.
echo.
echo Press any key to quit.
pause>nul
The problem is, the line
Code:
"C:\Program Files\Apache Group\Apache2\bin\apache.exe"
just causes the script to hang, as Apache is running in the same CMD window. Is there a way like Bourne Shell's & to run it in the background? I have tried using the start command, but it doesn't seem to start the server properly.
Output of the script:
Any help would be appreciated,
(PS - IE isn't my choice ;) )