使用 AutoIt3 在 Windows 下实现一个简单的 PHP-FPM

代码见真章,请勿直接用,按注释修改。

#NoTrayIcon

AutoItSetOption("MustDeclareVars", 1);限定变量必须先定义后使用,防止出错

;定义全局常量
Global Const $phpDir = "D:\Webserver\PHP53";PHP 路径
Global Const $phpFile = "php.exe";PHP 程序名
Global Const $phpExe = $phpDir & "\" & $phpFile;PHP 完整路径
Global Const $phpCgiFile = "php-cgi.exe";PHP-CGI 程序名
Global Const $phpCgiExe = $phpDir & "\" & $phpCgiFile;PHP-CGI 完整路径
Global Const $phpIniFile = "php.ini";PHP.INI 名
Global Const $phpIni = $phpDir & "\" & $phpIniFile;PHP.INI 完整路径

__onStart();运行前执行

OnAutoItExitRegister("__onExit");注册回调(退出后执行)

__main();执行主函数

Exit;退出

#comments-start
启动时运行函数
#comments-end
Func __onStart()

EndFunc ;==>__onStart

#comments-start
主函数
#comments-end
Func __main()
    If ($CmdLine[0] >= 1) Then
        __cmdMain()
        Exit
    EndIf
EndFunc ;==>__main

#comments-start
命令行主函数
#comments-end
Func __cmdMain()
    While 1
        If (__checkPhpCgiProcess() < $CmdLine[1]) Then
            __runPhpCgi($CmdLine[1] - __checkPhpCgiProcess())
        EndIf
        Sleep(10000)
    WEnd
EndFunc ;==>__cmdMain

#comments-start
退出时运行函数
#comments-end
Func __onExit()

EndFunc ;==>__onExit

#comments-start
检查 PHP-CGI 是否在运行
@return boolean 运行返回 true,否则返回 false
#comments-end
Func __checkPhpCgiState()
    Return ProcessExists($phpCgiFile)
EndFunc ;==>__checkPhpCgiState

#comments-start
检查 PHP-CGI 进程数
@return int 返回目前 PHP-CGI 进程数
#comments-end
Func __checkPhpCgiProcess()
    Local $phpCgiProcessArray = ProcessList($phpCgiFile)
    Return IsArray($phpCgiProcessArray) ? $phpCgiProcessArray[0][0] : 0;
EndFunc ;==>__checkPhpCgiProcess

#comments-start
运行 PHP-CGI
@param int $start 运行几个 PHP-CGI
#comments-end
Func __runPhpCgi($start = 3)
    Local $i = 1
    For $i = 1 To $start Step 1
        Run($phpCgiExe & " -b 127.0.0.1:9000", $phpDir, @SW_HIDE)
    Next
EndFunc ;==>__runPhpCgi

#comments-start
结束 PHP-CGI
#comments-end
Func __stopPhpCgi()
    While __checkPhpCgiState()
        __closePhpCgiProcess()
    WEnd
EndFunc ;==>__stopPhpCgi

#comments-start
结束 PHP-CGI 进程
#comments-end
Func __closePhpCgiProcess()
    ProcessClose($phpCgiFile)
EndFunc ;==>__closePhpCgiProcess
此文章是由nikbobo发表在PHP分类目录的。将固定链接加入收藏夹。

关于 nikbobo

Nikbobo,本名刘永强,记忆空间站长,男,1998 年出生于广东茂名,至今(2020 年)21 岁,目前(2020 年)就读于广州大学华软软件学院,常以“nikbobo”这个网名混迹互联网。如无特殊注明,Nikbobo 在本站发表的文章,遵循 知识共享 署名-非商业性使用-相同方式共享 4.0 国际 许可协议。详情请参阅关于页面的作者介绍。

使用 AutoIt3 在 Windows 下实现一个简单的 PHP-FPM》上有241个想法

  1. 好久不见,我最近发现了一款可以通过杀软锁主页软件,我想发给你研究一下。他的原理是什么。软件本身下载下来杀软都会拦截或者误杀。运行起来修改主页杀软虽然是有提示,但是最后还是被设置了。目前就360软件运行状态下无法设置主页。bobo什么时候有时间研究下。回复我信息。

    • 发到QQ邮箱,我看看,最近总算能有一点时间了,研究一下,不过我不干这个那么久了,还会不会也不保证。破出来就真的帅了。

  2. My developer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the expenses. But he’s tryiong none the less.
    I’ve been using WordPress on numerous websites for about a year and am anxious
    about switching to another platform. I have heard good things about blogengine.net.

    Is there a way I can transfer all my wordpress posts into it?

    Any kind of help would be greatly appreciated!

  3. restbet bonus ve bahis secenekleri genis bir site. restbet giris sonrasi harika bonuslarin sahibi oluyorsunuz. restbetamk.com guncel bir site.

  4. So far, I have read quite a few blog posts and reviewed different content. I think this is the best and original content I have ever seen, I congratulate you for the quality of the content you have prepared as sosyalarmut. You deserve appreciation.

  5. If you are looking for a dental office that is affordable, professional yet relaxing, then look no further than the dental office Edmonton. The staff at the dental office Edmonton will be able to assist you with all of your dental care needs while allowing you to take a break from work and still receive top notch dental services

  6. An Austin criminal defense lawyer can help you if you have been accused of a crime. If you are in the Austin area, you need to find the right criminal defense lawyer for your case. You need a legal counsel who has experience with all the different crimes that are committed in the Austin area.

  7. Commercial Cleaning Services Ottawa, Are you looking for commercial cleaning services? If the answer is yes, then you might want to read this article. Specifically, we’re going to talk about what commercial cleaning services actually are, and how they can benefit you.

  8. I read your article. I can say that it is a really useful last post. I will definitely be waiting for your other article on the subject. A very useful text. I love following your blog.

  9. Nice meth you sir, which you stated. Your favorite
    justification appeared to be on the web the easiest thing to be
    aware of. I say to you, I certainly get annoyed while people think about worries that they just do not know about.
    You managed to hit the nail upon the top as well as defined out the whole thing
    without having side effect , people could take a signal.
    Will probably be back to get more. Thanks

  10. Undeniably believe that which you stated. Your favorite
    justification appeared to be on the web the easiest thing to be
    aware of. I say to you, I certainly get annoyed while people think about worries that they just do not know about.
    You managed to hit the nail upon the top as well as defined out the whole thing
    without having side effect , people could take a signal.
    Will probably be back to get more. Thanks

  11. Here, is how to find Chegg Answers for free instantly to finish your online assignments conveniently. Student’s life nowadays has become very tough day by day especially for those college going students because of multiple homework and assignments.

  12. Many insurance agents would prefer to become an “insurance leader.” What exactly is this type of leadership and how does it differ from traditional leadership? Well, as we know, there are two kinds of leadership… traditional leadership and unconventional leadership.

  13. Many people do not understand what is load cell, which is why they do not get the results they want from their experiments. A load cell, in simple terms, is a device used to measure the amount of force that is applied across an object with no resistance. The amount of force will depend on the type of load cell being used. There are four types of load cells that are currently being used in applications around the world.

  14. B Турции не существует официальных ограничений при открытии компании иностранными учредителями. Права, гарантированные государством для турецких граждан при открытии бизнеса и приобретении акций, так же распространяются и на граждан иностранных государств.

  15. The Porto Funeral Home offers the most comprehensive services in the state of Connecticut. A traditional funeral service is held at the funeral home in accordance with local church rules. Family and friends may choose to have a memorial mass that includes the viewing of the cremated remains, interment and the distribution of the ashes

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注