doucepei5298 2014-04-24 16:20
浏览 32

Artisan服务发送带有嵌入响应头的资产

Maybe this is something obvious but I'm having a hard time, I just found out that my local PHP environment is delivering static files with the response headers embedded.

This is Laravel 4.1.26 with PHP 5.5.11 on Fedora 20, already tested laravel serve and php -S localhost:8000 server.php, both with equal results.

I tried with Firefox, Opera and Chromium, it looks like is displaying the raw binary response:

Opera displaying a css file

This is causing errors on all my js files.

enter image description here

For what is worth I tried curl and wget -q -O - and the responses are ok, no headers displayed. This looks like PHP's built-in server issue, where should I dig first?

EDIT:

This is not a PHP thing, it has something to do with Laravel's emulation of mod_rewrite with the file "server.php", if I step on the public folder and launch the server with php -S (ignoring server.php and laravel serve) then is all fine.

EDIT2:

Just narrowed the search, artisan serve runs ok in Debian 8 Jessie with the same PHP version (5.5.11), something is different in the Fedora environment.

  • 写回答

1条回答 默认 最新

  • duanlingzei0170 2016-08-22 13:41
    关注

    just change:

    if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
       return false;
    }
    

    to

    if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    ob_end_clean ();
       return false;
    }
    

    it solved it for me

    评论

报告相同问题?

悬赏问题

  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致