some version info:
PHP 8.0.2 (cli) (built: Feb 14 2021 14:21:15) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.2, Copyright (c) Zend Technologies
with Zend OPcache v8.0.2, Copyright (c), by Zend TechnologiesDistributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
here is the nginx error log
]]>2021/02/19 14:24:31 [error] 6646#6646: *3374855 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0 in /home/www/wp-admin/includes/class-pclzip.php:4212 Stack trace: #0 /home/www/wp-admin/includes/class-pclzip.php(4212): fread() #1 /home/www/wp-admin/includes/class-pclzip.php(3518): PclZip->privExtractFileAsString() #2 /home/www/wp-admin/includes/class-pclzip.php(811): PclZip->privExtractByRule() #3 /home/www/wp-admin/includes/file.php(1639): PclZip->extract() #4 /home/www/wp-admin/includes/file.php(1476): _unzip_file_pclzip() #5 /home/www/wp-admin/includes/class-wp-upgrader.php(328): unzip_file() #6 /home/www/wp-admin/includes/class-wp-upgrader.php(779): WP_Upgrader->unpack_package() #7 /home/www/wp-admin/includes/class-plugin-upgrader.php(137): WP_Upgrader->run() #8 /home/www/wp-admin/includes/ajax-actions.php(4346): Plugin_Upgrader->install() #9 /home/www/wp-includes/class-wp-hook.php(287): wp_ajax_ins" while reading response header from upstream, client: 79.143.250.149, server: clairelemoine.art, request: "POST /wp-admin/admin-ajax.php HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "clairelemoine.art", referrer: "https://clairelemoine.art/wp-admin/plugin-install.php?s=nextgen&tab=search&type=term"
On the last release of this plugin we noticed thumbnail generation stopped working on a number of our sites, both on CPanel servers and our custom hosting setups.
The sites are running FPM chroot with open_basedir and other restrictions in place.
ABSPATH is set to /app as we are inside a chroot’ed environment
DOCUMENT_ROOT is set to /home/user/html/site.com/app/
The change breaking our sites (and by the looks of this support forum many others) is down to a bespoke section of code specifically for wordpress.com regardless of other setups:
./app/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php
function initialize()
{
parent::initialize();
// Special hack for wordpress.com hosted accounts where ABSPATH is outside the DOCUMENT_ROOT
if (!empty($_SERVER['DOCUMENT_ROOT']) && strpos(ABSPATH, $_SERVER['DOCUMENT_ROOT']) === FALSE) {
$root = $_SERVER['DOCUMENT_ROOT'];
} else {
$root = ABSPATH;
}
$this->_document_root = $this->set_document_root($root);
}
So in our situation:
!empty($_SERVER['DOCUMENT_ROOT'])
is true
strpos(ABSPATH, $_SERVER['DOCUMENT_ROOT'])
is false as /home/user/html/site.com/app is not inside the string /app at any position
This triggers
$root = $_SERVER['DOCUMENT_ROOT'];
Which would set $root incorrectly to /home/user/html/site.com/app whereas PHP in a chroot like ours only knows about /app (chroot environments can only see inside their set path in theory).
Compounded by open_basedir set to /app as well our error logs were filling up with no such directory and access denied errors.
Current workarounds for now with some success:
FPM Config:
; WP Specific Absolute Path override for chroot
env[ABSPATH] = /app/
Sets the ABSPATH environment variable otherwise this will be set by wp-config.php
Apache Vhost:
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9050/app/$1
SetEnv document_root "/app/"
This overrides the document root variable given to the FPM process via proxypassmatch which then makes sure when hitting the wordpress.com workaround we succeed in setting the correct file system absolute path.
Personally a webserver document root isn’t really a valid way to detect a programming language’s directory of operation, perhaps prefer the programming language features over the supplied webserver environment variable?
]]>[core:error] [pid 86363] [client x.y.26.63:46166] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace., referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3752): [client x.y.26.63:46166] AH00121: r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
[core:debug] [pid 86363] core.c(3759): [client x.y.26.63:46166] AH00122: redirected from r->uri = /site1_test/wp-content/plugins/var/www/sites_htdocs/wp/wp-content/themes/quintus/quintus.css, referer: https://sites.example.com/site1_test/
This is only on sites using the quintus theme, so it seems to be an issue with the theme itself. Could anyone advise? Thank you!
]]>https://paste.debian.net/plainh/39c20686
Something seems wrong because the path is invalid. It’s looking in wp-content/plugins/var/www/sites_htdocs/wp/wp-content/…..
Is this a problem with the theme?
Thank you!
]]>Is this true or should i just go with nginx + phpfpm
]]>Every once in a while I see a request uri similar to this:
/wp-admin/admin-ajax.php?action=wordfence_logHuman&hid=08BAC5E3FF0166553DC21FE3D14E5A5E&r=0.2866429244168103
Now the thing is, it’s been a month since we’ve removed Wordfence, including its database entries and even manually removed the cron jobs it used to have.
What else could be making these calls?
Thanks,
Adam
2014/06/18 17:09:59 [error] 2003#0: *52986 FastCGI sent in stderr: "PHP message: PHP Warning: MemcachePool::getserverstatus() expects parameter 2 to be long, string given in /var/www/mywebsite.com/htdocs/wp-content/plugins/wp-ffpc/wp-ffpc-backend.php on line 921" while reading upstream, client: XXX.XXX.XXX.XXX, server: mywebsite.com, request: "GET /wp-admin/options-general.php?page=wp-ffpc-settings&saved=true HTTP/1.1", upstream: "fastcgi://unix:/var/lib/nginx/fastcgi/wptest.ch.sock:", host: "mywebsite.com", referrer: "https://mywebsite.com/wp-admin/options-general.php?page=wp-ffpc-settings&saved=true"
https://www.ads-software.com/plugins/wp-ffpc/
]]>Why not always use the /purge URL instead of unlinking files?
Here would be the PHP-FPM error message just in case:
2014/06/16 12:42:23 [error] 28902#0: *41796 FastCGI sent in stderr: "PHP message: PHP Warning: opendir(/var/run/nginx-cache/mywebsite.com/): failed to open dir: Permission denied in /var/www/mywebsite.com/htdocs/wp-content/plugins/nginx-helper/purger.php on line 686" while reading response header from upstream, client: XX.XX.XX.XX, server: www.mywebsite.com, request: "GET /wp-admin/post.php?post=482&action=edit&message=1&nginx_helper_action=purge&nginx_helper_urls=all&_wpnonce=a382bcef22 HTTP/1.1", upstream: "fastcgi://unix:/var/lib/nginx/fastcgi/mywebsite.com.sock:", host: "www.mywebsite.com", referrer: "https://www.mywebsite.com/wp-admin/post.php?post=482&action=edit&message=1"
https://www.ads-software.com/plugins/nginx-helper/
]]><VirtualHost _default_:80>
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /srv/http/domain
CustomLog /var/log/apache2/domain_access.log common
ErrorLog /var/log/apache2/domain_error.log
<Directory />
FallbackResource index.php
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/http/domain/$1
</VirtualHost>
]]>When php is used as FPM in Apache the X-Forwarded-For is not available via headers (varnish setup). There is no $headers[‘X-Forwarded-For’] (line 482 in inc/secure.php). Instead of there is variable _SERVER[“HTTP_X_FORWARDED_FOR”]. I suggest add another checking for it’s existence:
//Get the forwarded IP if it exists
if ( array_key_exists( ‘X-Forwarded-For’, $headers ) && ( filter_var( $headers[‘X-Forwarded-For’], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) || filter_var( $headers[‘X-Forwarded-For’], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) ) {
$theIP = $headers[‘X-Forwarded-For’];
} else if ( array_key_exists( ‘HTTP_X_FORWARDED_FOR’, $_SERVER ) && ( filter_var( $_SERVER[‘HTTP_X_FORWARDED_FOR’], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) || filter_var( $_SERVER[‘HTTP_X_FORWARDED_FOR’], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) ) {
$theIP = $_SERVER[‘HTTP_X_FORWARDED_FOR’];
} else {
$theIP = $_SERVER[‘REMOTE_ADDR’];
}
Best regards,
https://www.ads-software.com/plugins/better-wp-security/
]]>