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 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看