dongzhuo1498 2015-02-06 22:03
浏览 69
已采纳

通过浏览器访问时,PHP执行会提前终止

I'm trying to get my head around PHP and am setting a little script up on Apache/Linux.

If I call this as php index.php from the shell it executes fine. But if I call the same via my browser, it fails to execute. There is no info in the apache error log.

What can be the cause for this?

The script is scraping another getting a url via Goutte and curl, so takes about 3 seconds to execute.

-- To respond to comments --

I was omitting the code as it's trivial, a Goutte client, a single request followed by extracting the h1 tag.

It's working in the console but calling via Chrome tells me I am missing curl - which is install with apt-get install php-curl

  • 写回答

2条回答 默认 最新

  • donglao9606 2015-02-06 22:06
    关注

    Firstly, show php errors... paste this at the very top of your page

    ini_set('display_errors',1);
    ini_set('display_startup_errors',1);
    error_reporting(-1);
    

    Then view it, you should see a list of errors/warnings depending on the situation. Otherwise will need to see some of your code to know what your dealing with.

    If that fails and still gives you nothing/blank page.. Be sure a very basic php script works on your server through the web browser.

    <?php
      echo 'Hello World From PHP';
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度