I'm trying to reduce my script memory usage even more. I am trying to make my script generate output with xdebug to analyse the memory usage. It's a CLI based script has shebang
#!/usr/local/bin/php -q
I pass a parameter to it and check it with
$argc > 1 && is_numeric( $argv[1] )
When I login to ssh and do ./script.php 90
and add this code,
if( $argv[1] == 90 ) {
xdebug_start_trace('/var/www/html/logs/' . rand(1,9999999) );
}
I see the output file in the logs
folder.
But when I put the xdebug_start_trace
without the if
statement in production script, no output file is created.
The script.php
is called from another php file, placed in another folder, so I use absolute path in the filename and call it using exec
and append &> /dev/null &
to it, so it runs in the background.
This is driving me crazy! Help, guys!