dongle7553 2010-11-29 08:27
浏览 1581
已采纳

如何在没有Web服务器的情况下运行php?

I would like to ask if I can run a php without having installed a web server. Do I have to use the php like CGI and run my page via command line? And if so, what are the steps that I do I have to choose through the installation of php? I mean the preferences as CGI and the components after that step?

I installed the php 5.3.3 but is seems not working, I get several message that the php5ts.dll is missing and when I put that file in my ext folder other error messages appear. Are there any configuration files or steps that I have to use? (is php 5.3.3 suitable for doing something like this?)

If I have to have a web server installed how can I run my php code through the command line?

  • 写回答

5条回答 默认 最新

  • dqy006150 2010-11-29 08:36
    关注

    You should normally be able to run a php file (after a successful installation) just by running this command:

    $ /path/to/php myfile.php // unix way
    C:\php\php.exe myfile.php // windows way
    

    You can read more about running PHP in CLI mode here.


    It's worth adding that PHP from version 5.4 onwards is able to run a web server on its own. You can do it by running this code in a folder which you want to serve the pages from:

    $ php -S localhost:8000
    

    You can read more about running a PHP in a Web Server mode here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog