windows一键开启php_ioncube加密扩展

作者: ropon 分类: Cmd 发布时间: 2017-04-14 14:51
:: $Name:         iocube.bat
:: $Version:      v1.0
:: $Function:     一键安装ionCube加密扩展
:: $Author:       Ropon
:: $organization: west.cn
:: $Create Date:  2017-3-10
:: $Description:  1、一键安装ionCube加密扩展
::                2、支持预装环境及纯净版
::                3、支持php5.2-php7.0
::
::
@echo off&setlocal enabledelayedexpansion
set base=http://download.myhostadmin.net/php/ioncube
if not exist %cd%\wget.exe (
	echo.
	echo 缺少wget.exe程序
	explorer.exe http://download.myhostadmin.net/wget.exe
	echo 正在下载wget.exe必要程序,请保存到当前目录下
	echo 下载完成后按任意键继续
	pause
)
if not exist %cd%\wget.exe (
	echo.
	echo 自动头下载失败请访问 http://download.myhostadmin.net/wget.exe 手动下载
	echo 并保存到当前目录
	echo.
	pause
	exit
)
echo.	
if not exist %cd%\sed.rar (
	call:download http://download.myhostadmin.net/memcache/sed.rar %cd%\sed.rar
	"C:\Program Files\WinRAR\rar.exe" x -inul -o+  %cd%\sed.rar   %cd%  -y
	cls
)

:menu
echo.
echo 请选择php版本: 

echo   1 php5.2
echo   2 php5.3  
echo   3 php5.4 
echo   4 php5.5  
echo   5 php5.6
echo   6 php7.0
echo   0 退出

set /p first=

if %first% ==1 goto php52
if %first% ==2 call:phpbase 5.3
if %first% ==3 call:phpbase 5.4
if %first% ==4 call:phpbase 5.5
if %first% ==5 call:phpbase 5.6
if %first% ==6 call:phpbase 7.0
if %first% ==0 goto exit

:download
echo.
echo 正在下载所需组件
echo.
%cd%\wget.exe %~1 -O %~2
goto:eof

:existfloder
echo.
echo 检查是否安装对应版本php环境
if not exist %~1 (
	echo.
	echo 核实当前服务器没有安装php%~2
	pause
	goto exit
)
goto:eof

:php52
echo 请输入PHP安装路径:
echo 比如:d:\php
set path=
set /p "path=若使用建站助手,请直接回车:"
if defined path (
    set a=%path%
) else set a=D:\SOFT_PHP_PACKAGE\php\
call:existfloder %a% 5.2
set url=%base%/ioncube_loader_win_5.2_ts.dll
echo 一键安装ionCube加密扩展v6.0.9
if not exist %a%ext\ioncube_loader_win_5.2_ts.dll (
	call:download %url% %a%ext\ioncube_loader_win_5.2_ts.dll
	cls
)
C:\Windows\system32\cacls.exe "%a%ext\ioncube_loader_win_5.2_ts.dll" /e /g everyone:r
set b=D:/\SOFT_PHP_PACKAGE/\php/\ext/\ioncube_loader_win_5.2_ts.dll
copy "%a%php.ini" "%a%php_bak.ini" >nul 2>nul
%cd%\sed\sed.exe -i "/^\[Zend/a\zend_extension_ts=%b%" %a%php.ini
goto end

:phpbase
echo 请输入PHP安装路径:
echo 比如:d:\php
set path=
set /p "path=若使用建站助手,请直接回车:"
if defined path (
    set a=%path%
) else set a=D:\SOFT_PHP_PACKAGE\php%~1\
call:existfloder %a% %~1
set url=%base%/ioncube_loader_win_%~1.dll
set b=D:/\SOFT_PHP_PACKAGE/\php%~1/\ext/\ioncube_loader_win_%~1.dll
echo 一键安装ionCube加密扩展v6.0.9
if not exist %a%ext\ioncube_loader_win_%~1.dll (
	call:download %url% %a%ext\ioncube_loader_win_%~1.dll
	cls
)
C:\Windows\system32\cacls.exe "%a%ext\ioncube_loader_win_%~1.dll" /e /g everyone:r
copy "%a%php.ini" "%a%php_bak.ini" >nul 2>nul
%cd%\sed\sed.exe -i "/^\[Zend.loader/a\zend_extension=%b%" %a%php.ini
goto end

:end
echo.
echo 需要重启iis才能生效,正在重启中……
C:\Windows\system32\iisreset
echo.
echo 安装完成,请关闭窗口
echo.
echo.
echo   1 继续安装其他版本
echo   2 清理下载文件并退出
echo   0 退出
echo.
set /p choice=
if %choice% ==1 goto menu
if %choice% ==2 goto del
if %choice% ==0 goto exit

:del
echo.
echo 正在清理之前下载文件及文件夹……
echo.
for /f "delims=" %%i in ('dir /b /a-d /s "sed*"') do del %%i  
rd /s/q %cd%\sed
pause
exit

:exit
exit

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!