简体   繁体   English

文件写入在PHP扩展C / C ++(Linux)中不起作用

[英]File write not working in PHP extension c/c++ (linux)

I have created my own PHP extension in c++ (linux). 我已经在c ++(linux)中创建了自己的PHP扩展。 when zend engine compiles the PHP code am getting the active user functions and internal functions name. 当zend引擎编译PHP代码时,将获得活动的用户功能和内部功能名称。

To debug this php extension am using zend_printf to print the values. 要调试此php扩展,请使用zend_printf来打印值。

Instead of zend_printf wants to write in log file . 而不是zend_printf想要写入日志文件 I checked with FILE I/O, fstream not working here. 我检查了FILE I / O,fstream在这里不起作用。

How to create the log file in php extension using c/c++? 如何使用c / c ++在php扩展名中创建日志文件?

Finally i found my log file location. 最后,我找到了我的日志文件位置。 In my php extension had c++ code to open the file as follows, 在我的php扩展中,有c ++代码打开文件,如下所示:

fpo = fopen("/tmp/ResultRequest.txt", "a+"); fpo = fopen(“ / tmp / ResultRequest.txt”,“ a +”);

But it created inside the location " /tmp/systemd-private-*************-httpd.service-pRXgTf/tmp/ResultRequest.txt " 但是它是在位置“ /tmp/systemd-private-*************-httpd.service-pRXgTf/tmp/ResultRequest.txt ”中创建的

This location will be deleted when you restart the apache server. 重新启动apache服务器时,该位置将被删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM