You are not logged in.

#1 2013-11-26 01:52:08

Dave Cohen
Member
Registered: 2008-09-27
Posts: 126

[SOLVED] Apache + PHP + XDEBUG profiler refuses to write any files

I'm trying to track down some performance problems and the xdebug profiler seems like the tool to use.  Unfortunately no matter what I try xdebug simply will not write an output file.

I've searched these forums, and stackoverflow, and tried all suggestions.  Nothing helps.  No errors in log file.

I've made a directory, /tmp/xdebug, owned by user http and with proper permissions.

I've configured PHP with xdebug profiling enabled.  When I browse phpinfo via the web server, I see these settings for xdebug:

xdebug.profiler_aggregate	Off	Off
xdebug.profiler_append	Off	Off
xdebug.profiler_enable	On	On
xdebug.profiler_enable_trigger	Off	Off
xdebug.profiler_output_dir	/tmp/xdebug	/tmp/xdebug
xdebug.profiler_output_name	xdebug_profile.out.%t-%R	xdebug_profile.out.%t-%R

Other features of xdebug work fine.  For example, using emacs and geben I can place breakpoints, step through code, etc...

When I run php from the command line, I get the profile files written as expected.  For example:

dave@apollo ~ % sudo -u http php -r "echo 1;"                                                                                                                                                                                                                                       
1%                                                                                                                                                                                                                                                                                   
 
dave@apollo ~ % ls -lthr /tmp/xdebug                                                                                                                                                                                                                                                
total 4.0K
-rw-r--r-- 1 http http 146 Nov 25 17:49 xdebug_profile.out.1385430597-

That shows that user http can write to the directory.  And shows that PHP is configured to dump the files.  However no matter how I request a page from apache, nothing is written.  I'm completely at a loss.  Any help is appreciated.

Last edited by Dave Cohen (2014-02-23 18:20:10)

Offline

#2 2014-02-23 15:28:13

MarSoft
Member
Registered: 2013-02-03
Posts: 9

Re: [SOLVED] Apache + PHP + XDEBUG profiler refuses to write any files

Hello.
Just encountered the same problem. After long research it turned out that here in Arch https is launched with PrivateTmp=True. This means that when such process (including any its child, and including PHP and its library XDebug) tries to open "/tmp/*", it gets redirected to "/tmp/systemd-private-??????/tmp/*", also "/var/tmp/*" redirects to "/var/tmp/systemd-private-??????/tmp/*". So any directory you create in /tmp/ will not be used.
So the solution to this problem will be to use some path outside of /tmp, e.g. /srv/xdebug, or /var/log/xdebug, or anything. Make sure to create that directory and make it writeable for http user.
Also check your php.ini and ensure that you either have open_basedir disabled or that it includes your profiler_output_dir.

Last edited by MarSoft (2014-02-23 15:36:15)

Offline

#3 2014-02-23 18:20:36

Dave Cohen
Member
Registered: 2008-09-27
Posts: 126

Re: [SOLVED] Apache + PHP + XDEBUG profiler refuses to write any files

That was it! Thanks for posting.

Offline

#4 2015-05-29 01:59:12

JeanCarloMachado
Member
Registered: 2015-05-05
Posts: 1

Re: [SOLVED] Apache + PHP + XDEBUG profiler refuses to write any files

Changing permissions worked for me. Thanks.

Offline

#5 2015-05-29 02:14:20

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 17,041

Re: [SOLVED] Apache + PHP + XDEBUG profiler refuses to write any files

Two people agreeing.  Year old thread.

I guess it is safe to close.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB