卸载并重新安装apache / php和其他服务

时间:2013-02-09 00:15:36

标签: batch-file windows-services

我今天发帖是为了了解是否可以使用命令提示符从记忆棒中安装卸载服务(如Apache)。

我正在使用xampp作为我的LAMP Stack for windows。


问题1

这样做的原因是我经常往返于不同地点。用于旅行灯;我的老板要求我采用公司规范的记忆棒,用于使用预先建立的批处理脚本安装/卸载Apache服务。

我将能够访问我将要入住的计算机上的高级私密文件。但是这些机器中的大多数可能没有成功开发所需的要求。

所以我想知道我的树中是否有一个带有exe / libraries的文件夹?


问题2

我有这个批处理脚本。问题是,无论主要输入如何。它自动转到:Install ..出了什么问题?

@ECHO OFF
@ECHO Service Management 

@echo Please Select an Option

@echo 1) Install Apache and other set services
@echo 2) Uninstall Services
SET /p option = Please Select: 

IF "%option%" == "1" GOTO Install
IF "%option%" == "2" GOTO Uninstall
IF "%option%" gtr "2" GOTO Error
:Install
SET /p path=Enter Path Of MemoryStick (letter only): 
@echo Install
PAUSE
EXIT
:Uninstall
SET /p path=Enter Path Of MemoryStick (letter only): 
@echo Uninstall
PAUSE
EXIT
:Error
@echo Error. Please Re-run
PAUSE
EXIT

1 个答案:

答案 0 :(得分:0)

解。将记忆棒分配给通常不使用的字母。 Z:\例如。除非设定,否则什么都不会使用它。

您不需要命令提示符。您可以轻松复制必要的文件夹/文件。例如:

  

C:\ XAMPP \ apache的

     

C:\ XAMPP \ PHP

到你的记忆棒。对Apache目录中的必要配置文件进行更改。在这种情况下,它将是:

  

Z:\阿帕奇\ CONF \ httpd.conf中

将显示C:\xampp\htdocs的所有内容移至记忆棒上的其他目录。例如。假设您要使用目录 WebScripts

举个例子:

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "Z:/WebScripts"

股票httpd.conf上的第191行

<Directory "Z:/WebScripts">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.

股票httpd.conf上的第221行

在Z:\ root中创建该目录。如果这不存在,那么从记忆棒安装服务时会遇到错误。

安装Apache服务 在您的apache目录(Z:\ Apache)中,您会发现apache_installservice.batapache_uninstallservice.bat使用管理权限运行它们。

将创建服务,并将通过位于以下位置的exe运行:Z:\ Apache \ bin \ httpd.exe 它将收集所有配置文件并运行PHP支持的apache服务。