Click here to Skip to main content
15,887,359 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created my own PHP extension in c++ (linux). when zend engine compiles the PHP code am getting the active user functions and internal functions name.

To debug this php extension am using zend_printf to print the values.

Instead of zend_printf wants to write in log file. I checked with FILE I/O, fstream not working here.

How to create the log file in php extension using c/c++?

What I have tried:

I tried with c++ code(FILE *,Ofstream). No error in the code it compiles,but files not getting created in the given location.
Posted
Comments
Jochen Arndt 5-Jun-18 4:51am    
When code compiles without error it does not mean that it runs without error. I have not written such PHP extensions so far. But why should opening and writing to a file not work?
All I can think of are the usuals reasons:
Not existing directory part of the file name, no write access to the directory, or no write acces to the file itself if it exists already. I would use the /tmp directory because there usually all users can write.
Mohibur Rashid 5-Jun-18 5:31am    
Perhaps use configuration file for file path, file login, log file rotation etc.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900