这是一个自己在项目中遇到的问题。

由于一直以来,公司都是用的Linux服务器,这次为客户做项目,换成了winserver。

项目中有一项功能是Excel导出,采用PHPEXCEL类库实现。由于是个小项目,直接用PhpStudy搭建了服务器环境,代理选的是Apache,注册系统服务,自启动,以Network Service身份登录。

测试的时候导出功能报错,提示Could not open php://output for writing。目测是由于Network Service账号的权限不足导致的。但翻遍了网上的资料也没找到解决办法。

Windows系统下的临时目录是C:\Windows\Temp没问题,给该目录加上Network Service的权限也无效。

后来有发现导入的时候同样报错了,无法读取excel文件,所以跟踪导入的代码,发现上传文件的临时目录竟然是C:\Windows。继续跟踪PHPEXCEL的代码,找到了sys_get_temp_dir()方法。查看phpinfo,发现sys_temp_dir变量为空,于是手工指定sys_temp_dir = "C:\Windows\Temp" upload_tmp_dir = C:\Windows\Temp。问题解决。

Could not open php://output for writing.问题解决的更多相关文章

  1. DTrace to Troubleshoot Java Native Memory Problems

    How to Use DTrace to Troubleshoot Java Native Memory Problems on Oracle Solaris 11 Hands-On Labs of ...

  2. (转)MapReduce Design Patterns(chapter 7 (part 1))(十三)

    CHAPTER 7.Input and Output Patterns 本章关注一个最经常忽略的问题,来改进MapReduce 的value:自定义输入和输出.我们并不会总使用Mapreduce本身的 ...

  3. pychart

    Pychart PyChart is a Python library for creating high quality Encapsulated Postscript, PDF, PNG, or ...

  4. ubuntu 18.04下编译最新版本的KMS

    KMS:kurento媒体服务,即 kurento media server 很庞大的一个WEBRTC项目,GIT库主项目:https://github.com/Kurento 基础实现,修改了gst ...

  5. cuffdiff problem--Performed 0 isoform-level transcription difference tests

    如何解决cuffdiff运行结果中表达量为0的情况? cuffdiff -o cdiffout -b ref.fasta -u -p 15 --library-type fr-firststrand ...

  6. Introduction to Multi-Threaded, Multi-Core and Parallel Programming concepts

    https://katyscode.wordpress.com/2013/05/17/introduction-to-multi-threaded-multi-core-and-parallel-pr ...

  7. 树梅派 -- 通过/sys读写ADC芯片 pcf8591

    通过wiringPi等library, 在user space 通过/dev/i2c来读写i2c设备的方案不在本文讨论了. 编译SENSORS_PCF8591 模块 在Default raspberr ...

  8. Error:Some file crunching failed, see logs for details

    Information:Gradle tasks [:myapp2:assembleDebug] Error:Some file crunching failed, see logs for deta ...

  9. ASP.NET Core In Process Hosting on IIS with ASP.NET Core 2.2(转载)

    ASP.NET Core 2.2 has been out for a while now and with it come some significant improvements to the ...

随机推荐

  1. [ActionScript 3.0] 处理xml内容换行时行间距较大问题的一种简单方法

    我们一定遇到过这种情况,在读取xml里的文章内容时,一旦有换行的位置在flash里显示出来的行间距会比较大,而并非我们想要的效果,解决这个问题的方法除了使用正则表达式以外,这里介绍一种比较简单的方法, ...

  2. jquery源码解析:jQuery延迟对象Deferred(工具方法)详解2

    请接着上一课继续看. $.Deferred()方法中,有两个对象,一个是deferred对象,一个是promise对象. promise对象有以下几个方法:state,always,then,prom ...

  3. oracle 创建临时表空间/表空间,用户及授权

    1:创建临时表空间 create temporary tablespace user_temp tempfile 'Q:\oracle\product\10.2.0\oradata\Test\xyrj ...

  4. P4175 [CTSC2008]网络管理 树剖+树套树

    $ \color{#0066ff}{ 题目描述 }$ M公司是一个非常庞大的跨国公司,在许多国家都设有它的下属分支机构或部门.为了让分布在世界各地的N个部门之间协同工作,公司搭建了一个连接整个公司的通 ...

  5. Beginning and Ending the Speech

    Beginning and Ending the Speech Just as musical plays need appropriate beginnings and endings, so do ...

  6. 关于web界面设计的整体可维护性的感悟

    1.表现与数据分开管理: 某些数据具备特殊的表现格式,比如颜色,大小等等.为了对这些格式表现分开管理进行 a.使用css定义该类型数据的表现形式: 定义数据的类别,通过该类别对数据格式进行统一定义 . ...

  7. CF1063F. String Journey(后缀数组+线段树)

    题目链接 https://codeforces.com/contest/1063/problem/F 题解 虽然本题有时间复杂度较高但非常好写的做法...... 首先,若答案为 \(k\),则一定存在 ...

  8. Jenkins 发布平台 MSB4064: The "Retries" parameter is not supported & error MSB4063: The "Copy" task could not be initialized

    ____________________________________________________________________________________________________ ...

  9. pip和conda安装源更改

    pip和conda安装源更改 python模块安装,使用国内源可以提高下载速度. pip源更改: pip源有好几个,我一直用的清华的pip源,它5分钟同步一次. 临时使用: pip 后加参数 -i h ...

  10. java 接口的学习

    1   什么是接口 接口是一种引用数据类型.使用interface声明接口,形式:  public interface 接口名称{} 1.1.1 接口的特性 [1] 接口中可以声明属性.接口中定义的所 ...