PHP Notice: Undefined index: HTTP_X_FORWARDED_PROTO
-
When trying to use wp-cli (https://www.ads-software.com/support/topic/ewww-as-a-separate-php-tool-to-be-run-on-whole-whm-account)…
sudo -u www-data wp ewwwio optimize all ; echo $?
I got an error, I think:
PHP Notice: Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/bin/wp/php/wp-cli.php(23) : eval()'d code on line 7 Optimizing all with a 0 second pause between images. Scanning, this could take a while 47 images in the Media Library have been selected (0 unoptimized), with 288 resizes (0 unoptimized). 139
Due to exit code 139, there could be something wrong?
Some mistake by me or what could this be?
-
2.4.2 contains my suggested fix, so there wouldn’t be anything to change. Can you post the debugging from wp-cli again?
Here it is.
root@whonix:/var/www/blog# sudo -u www-data wp ewwwio optimize --debug all ; echo $? PHP Notice: Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/bin/wp/php/wp-cli.php(23) : eval()'d code on line 7 PHP Notice: Undefined index: SERVER_NAME in /var/www/blog/wp-content/plugins/post2email/post2email.php on line 47 Notice: Undefined index: SERVER_NAME in /var/www/blog/wp-content/plugins/post2email/post2email.php on line 47 Optimizing all with a 0 second pause between images. Scanning, this could take a while 47 images in the Media Library have been selected (0 unoptimized), with 288 resizes (0 unoptimized). 139 root@whonix:/var/www/blog#
Perhaps I can run it somehow with full execution trace log?
I’ve never done trace logs with wp-cli, so I’m not sure how that would even work. Seems like there has to be an error message somewhere if it is failing. Sometimes wp-cli will send php errors to syslog instead of your apache/nginx error.log.
Also, see what happens if you do ‘ewwwio optimize –debug other’ (instead of ‘all’).
root@whonix:/var/www/blog# sudo -u www-data wp ewwwio optimize --debug other PHP Notice: Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/bin/wp/php/wp-cli.php(23) : eval()'d code on line 7 PHP Notice: Undefined index: SERVER_NAME in /var/www/blog/wp-content/plugins/post2email/post2email.php on line 47 Notice: Undefined index: SERVER_NAME in /var/www/blog/wp-content/plugins/post2email/post2email.php on line 47 Optimizing other with a 0 second pause between images. Scanning, this could take a while root@whonix:/var/www/blog# echo $? 139
Nothing in the logs for above command.
But when I press “Scan and optimize” in the web interface, I get this in /var/log/apache2/error.log.
[Thu Jun 11 04:39:46.955893 2015] [:error] [pid 9810] [client 127.0.0.1:39650] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 4294964585 bytes) in /var/www/blog/wp-content/plugins/ewww-image-optimizer/ewww-image-optimizer.php on line 965, referer: https://www.whonix.org/blog/wp-admin/upload.php?page=ewww-image-optimizer-bulk
Tried to allocate ~ 4 GB. Is this the issue? Can this be reduced?
Yeah, that’s the problem. It’s running into another file that triggers an OOM error in the finfo commands. We’ll need to find out what it is. Here’s how we tracked it last time:
In the file ewww-image-optimizer.php, you should see this function at around line 954: ewww_image_optimizer_mimetype().
A couple lines into the function, you’ll see a debugging line that says something like “testing mimetype: $path”.
Directly below that line, add this:ewww_image_optimizer_debug_log();
Then, turn on debugging and run the wp-cli command. Then, please post the last 25-50 lines of output from ewww-image-optimizer/debug.log (via pastebin if necessary).
I was hoping to include a fix in this next release. Still might if you get a chance to test it today.
Strange… After making the change your suggested in your previous post… It’s working now… Still running. Could take a while. I’ll report back when it’s done.
root@whonix:/var/www/blog# www-data wp ewwwio optimize --debug other www-data: command not found root@whonix:/var/www/blog# sudo -u www-data wp ewwwio optimize --debug other PHP Notice: Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/bin/wp/php/wp-cli.php(23) : eval()'d code on line 7 PHP Notice: Undefined index: SERVER_NAME in /var/www/blog/wp-content/plugins/post2email/post2email.php on line 47 Notice: Undefined index: SERVER_NAME in /var/www/blog/wp-content/plugins/post2email/post2email.php on line 47 Optimizing other with a 0 second pause between images. Scanning, this could take a while 3464 images in other folders need optimizing. [y/n] y Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/parser/headbg.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/parser/headbg.jpg</span> is not writable Elapsed: 0.060 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/parser/wiki.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/parser/wiki.png</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/css/simple-ltr.gif <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/css/simple-ltr.gif</span> is not writable Elapsed: 0.059 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/css/simple-rtl.gif <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/css/simple-rtl.gif</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/filerepo/video.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/filerepo/video.png</span> is not writable Elapsed: 0.051 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/filerepo/wiki.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/filerepo/wiki.png</span> is not writable Elapsed: 0.065 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/exif-gps.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/exif-gps.jpg</span> is not writable Elapsed: 0.060 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-comment-multiple.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-comment-multiple.jpg</span> is not writable Elapsed: 0.059 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/nonanimated.gif <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/nonanimated.gif</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-iptc-bad-hash.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-iptc-bad-hash.jpg</span> is not writable Elapsed: 0.060 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-comment-iso8859-1.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-comment-iso8859-1.jpg</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/animated-xmp.gif <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/animated-xmp.gif</span> is not writable Elapsed: 0.050 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/iptc-timetest-invalid.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/iptc-timetest-invalid.jpg</span> is not writable Elapsed: 0.057 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/portrait-rotated.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/portrait-rotated.jpg</span> is not writable Elapsed: 0.051 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/exif-user-comment.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/exif-user-comment.jpg</span> is not writable Elapsed: 0.059 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/landscape-plain.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/landscape-plain.jpg</span> is not writable Elapsed: 0.059 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-comment-utf.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-comment-utf.jpg</span> is not writable Elapsed: 0.192 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/rgb-na-png.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/rgb-na-png.png</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/Animated_PNG_example_bouncing_beach_ball.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/Animated_PNG_example_bouncing_beach_ball.png</span> is not writable Elapsed: 0.067 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-padding-odd.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-padding-odd.jpg</span> is not writable Elapsed: 0.059 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/iptc-invalid-psir.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/iptc-invalid-psir.jpg</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/1bit-png.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/1bit-png.png</span> is not writable Elapsed: 0.061 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-xmp-alt.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-xmp-alt.jpg</span> is not writable Elapsed: 0.064 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/xmp.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/xmp.png</span> is not writable Elapsed: 0.059 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-comment-binary.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-comment-binary.jpg</span> is not writable Elapsed: 0.301 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-xmp-psir.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-xmp-psir.jpg</span> is not writable Elapsed: 0.059 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/iptc-timetest.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/iptc-timetest.jpg</span> is not writable Elapsed: 0.085 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/test.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/test.jpg</span> is not writable Elapsed: 0.090 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/Xmp-exif-multilingual_test.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/Xmp-exif-multilingual_test.jpg</span> is not writable Elapsed: 0.059 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/greyscale-png.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/greyscale-png.png</span> is not writable Elapsed: 0.050 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/broken_exif_date.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/broken_exif_date.jpg</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/Bishzilla_blink.gif <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/Bishzilla_blink.gif</span> is not writable Elapsed: 0.275 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-iptc-good-hash.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-iptc-good-hash.jpg</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/greyscale-na-png.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/greyscale-na-png.png</span> is not writable Elapsed: 0.093 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/Png-native-test.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/Png-native-test.png</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/animated.gif <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/animated.gif</span> is not writable Elapsed: 0.066 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/rgb-png.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/rgb-png.png</span> is not writable Elapsed: 0.058 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-padding-even.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/media/jpeg-padding-even.jpg</span> is not writable Elapsed: 0.349 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/cssmin/green.gif <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/cssmin/green.gif</span> is not writable Elapsed: 0.060 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/cssmin/red.gif <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/cssmin/red.gif</span> is not writable Elapsed: 0.051 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/cssmin/large.png <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/cssmin/large.png</span> is not writable Elapsed: 0.091 seconds Optimized image: /var/www/blog/wiki_images/tests/phpunit/data/upload/headbg.jpg <span class='code'>/var/www/blog/wiki_images/tests/phpunit/data/upload/headbg.jpg</span> is not writable Elapsed: 0.059 seconds Optimized image: /var/www/blog/wiki_images/images/temp/2/23/120px-12ene9f54m4w.yciqmk.2.png Reduced by 13.5% (698.0?B) Elapsed: 0.985 seconds Optimized image: /var/www/blog/wiki_images/images/temp/2/23/20140701124352!phpC56E6P.png Reduced by 0.4% (72.0?B) Elapsed: 4.428 seconds Optimized image: /var/www/blog/wiki_images/images/temp/8/87/20141114173059!phpFd6lE4.png Reduced by 0.7% (171.0?B) Elapsed: 4.268 seconds Optimized image: /var/www/blog/wiki_images/images/temp/4/49/120px-12q8jrk7xiko.77rfwj.372.gif Reduced by 0.1% (8.0?B) Elapsed: 0.244 seconds Optimized image: /var/www/blog/wiki_images/images/temp/4/49/20141114174253!phpUlFTm9.gif No savings Elapsed: 0.209 seconds Optimized image: /var/www/blog/wiki_images/images/temp/1/1d/20141114180251!phpJoN4rs.gif No savings Elapsed: 0.209 seconds Optimized image: /var/www/blog/wiki_images/images/temp/1/1d/120px-12q8lakczir0.vep2fo.372.gif Reduced by 0.1% (8.0?B) Elapsed: 0.200 seconds Optimized image: /var/www/blog/wiki_images/images/temp/3/3e/120px-11p2rpfp7de0.4ctjjy.1.gif Reduced by 0.0% (2.0?B) Elapsed: 0.227 seconds Optimized image: /var/www/blog/wiki_images/images/temp/3/3e/20130903221906!phpq4oPql.gif Reduced by 0.0% (8.0?B) Elapsed: 0.200 seconds Optimized image: /var/www/blog/wiki_images/images/temp/3/30/120px-12enea7cnko0.5tvtqv.2.png Reduced by 13.7% (713.0?B) Elapsed: 0.959 seconds Optimized image: /var/www/blog/wiki_images/images/temp/3/30/20140701124409!localcopy_a161ed58f7d8-1.png Reduced by 0.4% (72.0?B) Elapsed: 4.511 seconds Optimized image: /var/www/blog/wiki_images/images/temp/b/be/120px-12q8ktsnhkh4.qfat1.372.jpg No savings Elapsed: 0.206 seconds Optimized image: /var/www/blog/wiki_images/images/temp/b/be/20141114175646!phpIoFq5j.jpg Reduced by 2.3% (925.0?B) Elapsed: 0.156 seconds
Strange… After making the change you suggested above… It’s working now past that issue. Looks like. Still running. Could take a while. Will report back when it’s done. Output so far.
That is indeed strange, as the function merely tells the plugin to dump it’s debug buffer to the log file, doesn’t really have anything to do with the scanning and/or optimizing of images.
Unless… I can’t imagine the debug buffer is consuming 4GB of memory, but when you are all done, see what happens if you just take that debug_log line back out.
Successfully finished.
Also still works without that manual change.
Still works with 2.4.4.
- The topic ‘PHP Notice: Undefined index: HTTP_X_FORWARDED_PROTO’ is closed to new replies.