<small id='sHDF9'></small><noframes id='sHDF9'>

      <i id='sHDF9'><tr id='sHDF9'><dt id='sHDF9'><q id='sHDF9'><span id='sHDF9'><b id='sHDF9'><form id='sHDF9'><ins id='sHDF9'></ins><ul id='sHDF9'></ul><sub id='sHDF9'></sub></form><legend id='sHDF9'></legend><bdo id='sHDF9'><pre id='sHDF9'><center id='sHDF9'></center></pre></bdo></b><th id='sHDF9'></th></span></q></dt></tr></i><div id='sHDF9'><tfoot id='sHDF9'></tfoot><dl id='sHDF9'><fieldset id='sHDF9'></fieldset></dl></div>
    1. <legend id='sHDF9'><style id='sHDF9'><dir id='sHDF9'><q id='sHDF9'></q></dir></style></legend>
        <bdo id='sHDF9'></bdo><ul id='sHDF9'></ul>

    2. <tfoot id='sHDF9'></tfoot>

      Bash 脚本来运行 php 脚本

      Bash script to run php script(Bash 脚本来运行 php 脚本)
      <legend id='joJfI'><style id='joJfI'><dir id='joJfI'><q id='joJfI'></q></dir></style></legend>

            <tbody id='joJfI'></tbody>

          <i id='joJfI'><tr id='joJfI'><dt id='joJfI'><q id='joJfI'><span id='joJfI'><b id='joJfI'><form id='joJfI'><ins id='joJfI'></ins><ul id='joJfI'></ul><sub id='joJfI'></sub></form><legend id='joJfI'></legend><bdo id='joJfI'><pre id='joJfI'><center id='joJfI'></center></pre></bdo></b><th id='joJfI'></th></span></q></dt></tr></i><div id='joJfI'><tfoot id='joJfI'></tfoot><dl id='joJfI'><fieldset id='joJfI'></fieldset></dl></div>

          1. <small id='joJfI'></small><noframes id='joJfI'>

            <tfoot id='joJfI'></tfoot>
              • <bdo id='joJfI'></bdo><ul id='joJfI'></ul>

                本文介绍了Bash 脚本来运行 php 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个 php 脚本,我想使用 bash 脚本运行它,所以我可以使用 Cron 每分钟左右运行一次 php 脚本.

                I have a php script that I want to be run using a bash script, so I can use Cron to run the php script every minute or so.

                据我所知,我需要创建 bash 脚本来处理 php 脚本,然后我才能使用 Cron 工具/计时器.

                As far as I'm aware I need to create the bash script to handle the php script which will then allow me to use the Cron tool/timer.

                到目前为止,我被告知我需要:

                So far I was told I need to put:

                #!/pathtoscript/testphp.php
                

                在我的 php 脚本的开头.我不知道从这里做什么...

                at the start of my php script. Im not sure what to do from here...

                有什么建议吗?谢谢.

                推荐答案

                如果你安装了 PHP 作为命令行工具(尝试将 php 发送到终端,看看它是否有效),你的shebang(#!) 行需要如下所示:

                If you have PHP installed as a command line tool (try issuing php to the terminal and see if it works), your shebang (#!) line needs to look like this:

                #!/usr/bin/php
                

                将它放在脚本的顶部,使其可执行(chmod +x myscript.php),并创建一个 Cron 作业来执行该脚本(与执行 bash 脚本的方式相同)).

                Put that at the top of your script, make it executable (chmod +x myscript.php), and make a Cron job to execute that script (same way you'd execute a bash script).

                您也可以使用 php myscript.php.

                这篇关于Bash 脚本来运行 php 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Is PHP or PHP based web framework stateful or stateless?(PHP 或基于 PHP 的 Web 框架是有状态的还是无状态的?)
                How to parse django style template tags(如何解析 django 样式模板标签)
                What is a good setup for editing PHP in Emacs?(在 Emacs 中编辑 PHP 的好设置是什么?)
                How to check whether specified PID is currently running without invoking ps from PHP?(如何在不从 PHP 调用 ps 的情况下检查指定的 PID 当前是否正在运行?)
                What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
                php in background exec() function(php 后台 exec() 函数)

                  <i id='B8k2A'><tr id='B8k2A'><dt id='B8k2A'><q id='B8k2A'><span id='B8k2A'><b id='B8k2A'><form id='B8k2A'><ins id='B8k2A'></ins><ul id='B8k2A'></ul><sub id='B8k2A'></sub></form><legend id='B8k2A'></legend><bdo id='B8k2A'><pre id='B8k2A'><center id='B8k2A'></center></pre></bdo></b><th id='B8k2A'></th></span></q></dt></tr></i><div id='B8k2A'><tfoot id='B8k2A'></tfoot><dl id='B8k2A'><fieldset id='B8k2A'></fieldset></dl></div>
                  • <small id='B8k2A'></small><noframes id='B8k2A'>

                    <legend id='B8k2A'><style id='B8k2A'><dir id='B8k2A'><q id='B8k2A'></q></dir></style></legend>

                        <bdo id='B8k2A'></bdo><ul id='B8k2A'></ul>

                          <tbody id='B8k2A'></tbody>
                      • <tfoot id='B8k2A'></tfoot>