Search…

X3 Photo Gallery Support Forums

Search…
 
nisekoi
Topic Author
Posts: 8
Joined: 24 Jan 2021, 06:49

files显示的缩略图为空白

24 Jan 2021, 08:18

我的nginx版本为1.18 php 7.3
PHP禁用函数与扩展
 Image
Image



当打开时页面。缩略图的请求返回了一个空白页面, 我检查了很多地方。无法找到原因。这是我的网页地址。
http://134.195.88.23/ 我将index.php的源码放在了index.php.bak
phpinfo http://134.195.88.23/phpinfo.php

Image
Image
Last edited by nisekoi on 24 Jan 2021, 08:29, edited 1 time in total.
 
nisekoi
Topic Author
Posts: 8
Joined: 24 Jan 2021, 06:49

Re: files显示的缩略图为空白

24 Jan 2021, 08:20

我是否发错了版块 :thinking:
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: files显示的缩略图为空白

24 Jan 2021, 23:43

谷歌翻译:

我检查了您的页面,并调整了文件 1.jpg 的大小,同时调整了 testimg.jpg 的大小。 我看不到您的PHP有任何错误。 您能否上传更多随机图像,以便我们查看它是否与图像有关或其他?

造成问题的是,失败的图像调整大小链接不会输出任何错误,只是空白的“ 200 OK”响应。
http://134.195.88.23/index.php?file=tes ... 18.2048211
 
nisekoi
Topic Author
Posts: 8
Joined: 24 Jan 2021, 06:49

Re: files显示的缩略图为空白

25 Jan 2021, 01:21

mjau-mjau wrote: 谷歌翻译:

我检查了您的页面,并调整了文件 1.jpg 的大小,同时调整了 testimg.jpg 的大小。 我看不到您的PHP有任何错误。 您能否上传更多随机图像,以便我们查看它是否与图像有关或其他?

造成问题的是,失败的图像调整大小链接不会输出任何错误,只是空白的“ 200 OK”响应。
http://134.195.88.23/index.php?file=tes ... 18.2048211
http://134.195.88.23/
我从 https://demo.files.gallery/?balloons 下载了一些图片 上传到了服务器。他依旧无法显示缩略图  :sob: 这大概不是图片的问题  我还能提供什么信息
http://134.195.88.23/
I downloaded some pictures from https://demo.files.gallery/?balloons and uploaded them to the server. He still can’t display the thumbnail.   :sob: This is probably not a problem with the picture. What more information can I provide
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: files显示的缩略图为空白

25 Jan 2021, 01:47

我很难诊断,因为这是您自己的服务器。 首先,当我今天早些时候检查时,其中一张图像正在工作...但是现在它不再起作用:
http://134.195.88.23/index.php?file=1.j ... 179.155242

这使我相信某些东西必须更改,因为该图像最初是有效的。 另外,index.php.bak有什么意义? 您编辑了主文件? 您的服务器为什么不报告图像链接的任何内容,而仅报告白色输出? 至少它应该输出类似错误的内容。 这看起来像NGINX(不是PHP),但不幸的是,我从这里看不到。 也许一些nginx绕过缓存?

在“文件”应用中,所有内容均存在错误,但您的nginx也会绕过此错误。
 
nisekoi
Topic Author
Posts: 8
Joined: 24 Jan 2021, 06:49

Re: files显示的缩略图为空白

25 Jan 2021, 01:55

mjau-mjau wrote: 我很难诊断,因为这是您自己的服务器。 首先,当我今天早些时候检查时,其中一张图像正在工作...但是现在它不再起作用:
http://134.195.88.23/index.php?file=1.j ... 179.155242

这使我相信某些东西必须更改,因为该图像最初是有效的。 另外,index.php.bak有什么意义? 您编辑了主文件? 您的服务器为什么不报告图像链接的任何内容,而仅报告白色输出? 至少它应该输出类似错误的内容。 这看起来像NGINX(不是PHP),但不幸的是,我从这里看不到。 也许一些nginx绕过缓存?

在“文件”应用中,所有内容均存在错误,
谢谢你的回复
在极少数的情况下,会偶尔有一张图像会出现缩略图。但是如果我再重新访问一遍resize的url(而不是缓存)
比如 http://134.195.88.23/index.php?file=1.j ... 179.155242 那么他会重新变为空白
我刚才打开页面查看时。这张图片又有了缩略图。
Image

我没有对主文件函数部分进行任何更改,  index.php.bak 是为了让你看到我在config部分的设置
或许我可以提供更多的信息? 你需要什么吗 这是我nginx vhost

Code
server
{
    listen 80;
    server_name 134.195.88.23;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/134.195.88.23;
    

    #error_page 404/404.html;
    #SSL-END
    
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END
    
    include enable-php-73.conf;
    #PHP-INFO-END
    
    
    include /www/server/panel/vhost/rewrite/134.195.88.23.conf;
    #REWRITE-END
    
    
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    
    
    location ~ \.well-known{
        allow all;
    }
    
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log /dev/null;
        access_log off;
    }
    
    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log off; 
    }
    access_log  /www/wwwlogs/134.195.88.23.log;
    error_log  /www/wwwlogs/134.195.88.23.error.log;
}
 
nisekoi
Topic Author
Posts: 8
Joined: 24 Jan 2021, 06:49

Re: files显示的缩略图为空白

25 Jan 2021, 02:10

Update

我在index.php的开头添加了一句
Code
ini_set("memory_limit","512M");
便能够正常生成缩略图了。不知道为什么下面这一行没有生效
Code
    'image_resize_memory_limit' => 512, // 128 MB is suffient to resize images around 6000 px / 0 = ignore memory
------------------------

在Nginx的错误日志中。似乎存在着事件的原因
但是我的服务器还有着不少内存 177 / 3946 (MB)
phpinfo里也可以看到 
Code
memory_limit = 512MB
我完全无法理解


Code
2021/01/25 15:07:52 [error] 31232#0: *797 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 1052672 bytes) in /www/wwwroot/134.195.88.23/index.php on line 401" while reading response header from upstream, client: 206.190.234.207, server: 134.195.88.23, request: "GET /index.php?file=ali-abdul-rahman-3kEkV4Aj0Lc-unsplash.jpg&resize=320&81df7d.1611555441.70077 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-73.sock:", host: "134.195.88.23", referrer: "http://134.195.88.23/"
2021/01/25 15:07:52 [error] 31232#0: *793 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 8192 bytes) in /www/wwwroot/134.195.88.23/index.php on line 602" while reading response header from upstream, client: 206.190.234.207, server: 134.195.88.23, request: "GET /index.php?file=anna-kurguzina-rFGJKkoTFo4-unsplash.jpg&resize=320&81df7d.1611555440.111337 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-73.sock:", host: "134.195.88.23", referrer: "http://134.195.88.23/"
2021/01/25 15:07:53 [error] 31232#0: *801 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 1052672 bytes) in /www/wwwroot/134.195.88.23/index.php on line 401" while reading response header from upstream, client: 206.190.234.207, server: 134.195.88.23, request: "GET /index.php?file=view.jpg&resize=320&81df7d.1611555539.76238 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-73.sock:", host: "134.195.88.23", referrer: "http://134.195.88.23/"
2021/01/25 15:07:53 [error] 31232#0: *803 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 1052672 bytes) in /www/wwwroot/134.195.88.23/index.php on line 401" while reading response header from upstream, client: 206.190.234.207, server: 134.195.88.23, request: "GET /index.php?file=testimg.jpg&resize=320&81df7d.1611490118.2048211 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-73.sock:", host: "134.195.88.23", referrer: "http://134.195.88.23/"
2021/01/25 15:07:53 [error] 31232#0: *805 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 1224704 bytes) in /www/wwwroot/134.195.88.23/index.php on line 401" while reading response header from upstream, client: 206.190.234.207, server: 134.195.88.23, request: "GET /index.php?file=hosea-georgeson-_8k7ZPFS4q8-unsplash.jpg&resize=320&81df7d.1611555437.152674 HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-73.sock:", host: "134.195.88.23", referrer: "http://134.195.88.23/"

 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: files显示的缩略图为空白

25 Jan 2021, 03:15

这样就可以了吗? 是的,内存限制是一个合理的解释。 我不认为它是memory_limit的原因是:1)默认情况下,您的服务器已经分配了512MB,2)测试的图像很小,并且3)没有“ PHP致命错误:允许的内存大小” 输出中的错误,这是内存用完时的正常错误输出。 也许您的服务器正在以某种方式抑制错误。
我在index.php的开头添加了一句
Code
ini_set("memory_limit","512M");
如果您的内存已经是512MB,您必须设置此项很奇怪。 发生了一些奇怪的事情!
 
nisekoi
Topic Author
Posts: 8
Joined: 24 Jan 2021, 06:49

Re: files显示的缩略图为空白

25 Jan 2021, 03:30

mjau-mjau wrote: 这样就可以了吗?
是的,现在一切正常。 :grinning:
我一开始从未想过错误日志会在nginx里


我不清楚为什么index.php 在2M的内存限制下运行(2097152 bytes)。
Code
FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 1224704 bytes) 
class config 里面的 'image_resize_memory_limit' => 512 和 php.ini 里面的 memory_limit=512M 
都没有生效
 


Image
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: files显示的缩略图为空白

25 Jan 2021, 03:35

很高兴至少可以解决!

似乎您的内存限制在某处或以某种方式设置为2MB。 我可以进行进一步调查,但需要将FTP传输到服务器。
 
nisekoi
Topic Author
Posts: 8
Joined: 24 Jan 2021, 06:49

Re: files显示的缩略图为空白

25 Jan 2021, 04:01

mjau-mjau wrote: 很高兴至少可以解决!

似乎您的内存限制在某处或以某种方式设置为2MB。 我可以进行进一步调查,但需要将FTP传输到服务器。
我将FTP连接信息发送给你了。ftp目录相当于http://134.195.88.23的根目录
如果需要其他目录的权限请告诉我,我对这个问题相当好奇 
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: files显示的缩略图为空白

25 Jan 2021, 04:51

Ok, I have checked server. Here are my tests in English ... Please use Google translate.

I created a new file test.php:
http://134.195.88.23/test.php

1. Does NOT work:
Code
// ini_set("memory_limit","512M");
$mem = ini_get('memory_limit');
var_dump($mem);
exit();
2. Works when first assigning ini_set():
Code
ini_set("memory_limit","512M");
$mem = ini_get('memory_limit');
var_dump($mem);
exit();
3. Even stranger, this does NOT work:
Code
var_dump('test');
exit();
4. This works. Why?:
Code
ini_set("memory_limit","512M");
var_dump('test');
exit();
You have some issue on your server. Not sure if it's memory related or security-related or buffer-output related, but it's not normal. Script execution is breaking in the middle of the script for unknown reasons. Why 3 doesn't work and then why does 4 work? You might want to run the above while checking your server error log ...
 
nisekoi
Topic Author
Posts: 8
Joined: 24 Jan 2021, 06:49

Re: files显示的缩略图为空白

25 Jan 2021, 05:54

mjau-mjau wrote:
You have some issue on your server. Not sure if it's memory related or security-related or buffer-output related, but it's not normal. Script execution is breaking in the middle of the script for unknown reasons. Why 3 doesn't work and then why does 4 work? You might want to run the above while checking your server error log ...
感谢你的测试,但是我对php不太了解。无法进行深度的测试。
不过这应该是我php出了问题。我将php从7.3 更换为了 7.4之后,一切的状态都正常了

Thanks for your test, but I don't know much about php. In-depth testing is not possible.
But this should be a problem with my php. After I changed PHP from 7.3 to 7.4, everything is normal

1. output string(4) "128M"

Code
// ini_set("memory_limit","512M");
$mem = ini_get('memory_limit');
var_dump($mem);
exit();
2. output string(4) "512M"
Code
ini_set("memory_limit","512M");
$mem = ini_get('memory_limit');
var_dump($mem);
exit();
3. output string(4) "test"

Code
var_dump('test');
exit();
4. output string(4) "test"

Code
ini_set("memory_limit","512M");
var_dump('test');
exit();
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: files显示的缩略图为空白

25 Jan 2021, 23:47

nisekoi wrote:After I changed PHP from 7.3 to 7.4, everything is normal
Good! :clap: Maybe something wrong in the PHP 7.3 configuration.