我在 iTop 安装期间收到此消息。如果你用谷歌搜索这个,它会出现在商业网站的内容之上。
警告:filter_var():JIT 内存分配失败,PCRE JIT 将被禁用。这可能是因为安全限制。要么授予 PHP 执行内存的权限,要么在 /var/www/html/itop/web/application/utils.php 第 338 行设置 pcre.jit=0。
“修复”包含在警告消息中,但我想更多地了解发生了什么。也许我希望 PHP 分配可执行内存。任何见解将不胜感激。
我正在尝试使用 apache2 和 nginx 使用 php7.0-fpm 构建一个 dockerized ubuntu 16.04lts
我使用过但没有用的命令
[program:php-fpm7.0]
command = /usr/sbin/php-fpm7.0 --daemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
Run Code Online (Sandbox Code Playgroud)
和
[program:php-fpm7.0]
command = /usr/sbin/php-fpm7.0 -c /etc/php/7.0/fpm/php-fpm.conf
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
Run Code Online (Sandbox Code Playgroud)
和
[program:php-fpm7.0]
command = /usr/sbin/php-fpm7.0 -c /etc/php/7.0/fpm
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
Run Code Online (Sandbox Code Playgroud)
以下是我尝试作为容器运行时来自 docker 的错误日志
从 apache2 容器
2016-06-26 20:04:21,488 CRIT Set uid to user 0
2016-06-26 20:04:21,496 INFO RPC interface 'supervisor' initialized
2016-06-26 20:04:21,496 CRIT Server 'unix_http_server' running …Run Code Online (Sandbox Code Playgroud) 目前在我的 Centos 6.8 服务器上有一个 502 Bad Gateway 错误。
2017/01/30 23:57:31 [crit] 26911#0: *1 connect() to unix:/var/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.0.15, server: 192.168.0.$
Run Code Online (Sandbox Code Playgroud)
我检查了目录是否存在,它不存在。我能找到的最接近该文件夹的是 /var/run/php-fpm,它只包含 php-fpm.pid。
我让 PHP-FPM 监听 Unix 域套接字,并www使用以下值配置了池(唯一存在的):
slowlog = /$pool.log.slow
request_slowlog_timeout = 10s
Run Code Online (Sandbox Code Playgroud)
为了测试,我将 max_execution_time 设置php.ini为 20 秒。然后我创建了一个测试脚本:
<?php
while(1){
$i++;
}
?>
Run Code Online (Sandbox Code Playgroud)
然后通过网络浏览器访问它。脚本最终超时,原因是max_execution_time但日志仍为空:
root@b7e4a919c988:/var/www/html# ll /www.log.slow
-rw-rw-rw-. 1 www-data root 0 Jan 4 21:31 /www.log.slow
Run Code Online (Sandbox Code Playgroud)
不过,PHP-FPM 日志似乎表明它期望记录缓慢的运行:
[04-Jan-2018 21:37:28] WARNING: [pool www] child 9382, script '/var/www/html/test.php' (request: "GET /test.php") executing too slow (13.061999 sec), logging
Run Code Online (Sandbox Code Playgroud)
我尝试了各种方法,例如使用循环sleep(10000)或将while循环放入函数中(以防万一它无法构建堆栈跟踪),但似乎没有什么可以让它将回溯打印到日志中。日志文件本身的存在似乎也表明 FPM 预计会写入缓慢的请求。
此时我只是不知道还要检查什么。
我正在运行 CentOS 7.4 和 HTTP 2.4.6
我安装了 PHP 7.2.3
我知道需要降级到 7.0(原因是软件公司最初告诉我安装 PHP 的最新/稳定版本,现在他们告诉我 7.2 不起作用,我需要 7.0——呃)
如何在 PHP 中从 7.2 升级到 7.0?
php -v返回:PHP 7.2.3 (cli)(构建时间:2018 年 3 月 2 日 12:41:10)( NTS )
我正在使用:MediaWiki 1.30.0 PHP 7.4.1 (apache2handler) MariaDB 10.3.21-MariaDB-1:10.3.21+maria~jessie
我在日志中经常收到此错误:
-PHP Notice: Trying to access array offset on value of type null in .../wiki/includes/profiler/SectionProfiler.php on line 99
-PHP Notice: Trying to access array offset on value of type null in .../wiki/includes/profiler/SectionProfiler.php on line 100
-PHP Notice: Trying to access array offset on value of type null in .../wiki/includes/profiler/SectionProfiler.php on line 101
Run Code Online (Sandbox Code Playgroud)
我尝试用谷歌搜索这个,但它经常将我发送到其他 MediaWiki 站点并带有此通知,而不是对该问题的讨论。
问候
我正在使用用于原始 PHP 版本的配置选项在 CentOS 6.7 上为 PHP7 设置 alt 安装:
./configure --disable-fileinfo --disable-opcache --disable-posix --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-mbstring --enable-pdo=shared --enable-soap --enable-sockets --enable-zip --prefix=/usr/local/php7 --with-bz2 --with-curl=/opt/curlssl/ --with-freetype-dir=/usr --with-gd --with-gettext --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/opt/pcre --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-tidy=/opt/tidy/ --with-xpm-dir=/usr --with-zlib --with-zlib-dir=/usr
Run Code Online (Sandbox Code Playgroud)
虽然它抛出以下错误:
configure: WARNING: unrecognized options: --with-mysql
Run Code Online (Sandbox Code Playgroud)
有没有人知道 PHP7 的正确选项是什么,我似乎无法在 Google 上找到它?谢谢 :)
我尝试了以下命令来检查单个 PHP-FPM 进程的平均内存使用情况
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
Run Code Online (Sandbox Code Playgroud)
我有一个错误 awk: cmd. line:1: fatal: division by zero attempted
而这个命令
total=0; for i in `ps -C php-fpm -o rss=`; do total=$(($total+$i)); done; echo "Memory usage: $total kb";
Memory usage: 0 kb
ps -ef | grep php
root 9435 1 0 11:42 ? 00:00:00 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
somename+ 9438 9435 0 11:42 ? 00:00:00 php-fpm: pool somename-1
somename+ 9439 9435 …Run Code Online (Sandbox Code Playgroud) 我使用 Docker 镜像php:7.2-fpm-alpine作为基础镜像,使用以下命令安装 Imagick:
RUN apk add --update --no-cache autoconf g++ imagemagick-dev libtool make pcre-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& apk del autoconf g++ libtool make pcre-dev
Run Code Online (Sandbox Code Playgroud)
构建一切顺利,我有带有 Imagick 的 php7.2,但由于以下错误而无法使用:
UnableToOpenConfigureFile `coder.xml' @ warning/configure.c/GetConfigureOptions/714
Run Code Online (Sandbox Code Playgroud)
我试图解决这个问题两个小时。我尝试添加 XML 库但没有任何运气。有任何想法吗?
今晚我将我的 VPS 从 Ubuntu 16.04 LTS 升级到 Ubuntu 18.04 LTS。一切都按预期进行,对 php aisle 5.6 进行了一些清理,并在 php aisle 7.4 上进行了一些库存货架。在我更改所有配置和模组后,Apache 毫无怨言地重新启动了;我以为我可以走了。但我的 4 个网站中有 3 个无法加载;没有干净的 404 页面,只有这个错误配置消息。
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Run Code Online (Sandbox Code Playgroud)
审查后/var/log/apache2/error.log,我发现了这一点:
[Wed May 06 03:55:16.190469 2020] [core:alert] [pid 5657] [client 10.10.10.10:56897]
/var/www/abc/example.com/.htaccess: No comments are allowed here, referer: https://example.com/
Run Code Online (Sandbox Code Playgroud)
在尝试了几种不同的方法之后,似乎开始行的注释不是问题,而是结束文件正常行的注释。删除这些评论或将这些#main office评论移动到自己的行中将使所有内容恢复在线。该# Allow from this IP address行仍在我的 .htaccess 文件中,但不会给我带来任何悲伤。
<Files wp-login.php>
order …Run Code Online (Sandbox Code Playgroud) 当我想执行 php 文件时,它会在浏览器中显示为文本。
我在 Hostinger 有一个 VPS,我安装了带有 Webmin 和 LAMP 的 Ubuntu 18.04(自动安装)。
我检查了安装,见下文。
apache2 - v并php -v给了我:Apache/2.4.29和 PHP7.2.24-0ubuntu0.18.04.6
所以一切似乎都安装正确。
我的默认文件夹是 /var/www/html/ 我不在我的代码中使用短标签。
我尝试午餐一个名为 phpinfo.php 的文件,内容如下:
<?php
phpinfo();
?>
Run Code Online (Sandbox Code Playgroud)
并且纯文本出现在页面上。
如果文件以 html 代码开头,则即使使用 .php 文件,它也会正确呈现。但是php部分没有执行。例如:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
<?php
phpinfo();
?>
Run Code Online (Sandbox Code Playgroud)
渲染:你好
但
<?php
phpinfo();
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
将代码呈现为纯文本。
这是一个常见问题,但我仔细检查了建议的解决方案,但没有成功。
这些是来自 PHP 的错误:
Warning: move_uploaded_file(images/img01.jpg): failed to open stream: Permission denied in /usr/share/nginx/html/media/test.php on line 28
Warning: move_uploaded_file(): Unable to move '/tmp/phpRvUCVx' to 'images/img01.jpg' in /usr/share/nginx/html/media/test.php on line 28
Run Code Online (Sandbox Code Playgroud)
服务器已经安装了 nginx 和 php 7.3 (php-fpm)
上传文件夹的权限:
drwxrwxrwx. 2 nginx nginx 6 Apr 5 03:11 images
Run Code Online (Sandbox Code Playgroud)
信息来自ps aux | grep php
centos 24211 0.0 0.0 112708 980 pts/0 S+ 16:01 0:00 grep --color=auto php
root 24674 0.0 0.6 285532 11452 ? Ss Apr04 0:04 php-fpm: master process (/etc/opt/remi/php73/php-fpm.conf)
nginx 24675 …Run Code Online (Sandbox Code Playgroud) 我在网络服务器方面的经验是:Total Noob -> 为 cPanel 托管服务提供商工作。
大约一年前,我给自己设定了一个有趣的挑战,即在没有 cPanel 的情况下像配置 cPanel 服务器一样配置网络服务器。此时我是 1 级,所以这是晋升的好准备。
最大的惊喜当然是没有 PHP 7?!我想我在这方面被宠坏了。现在,每次我配置新服务器时,我都会在谷歌周围试图记住上次添加的存储库时内心愤怒。
我的问题是 - 为什么 Centos/Redhat 在他们自己的存储库中没有 PHP 7?而且,在许多确实具有 PHP 7 的存储库中,它们中的任何一个都比其他存储库更可靠,还是大致相同?
我真的注册了服务器故障只是为了问这个问题,因为我无法通过谷歌在任何地方找到它。您只是倾向于获得有关如何安装 [webstatic,ius,remi] 存储库的说明。如果这是一个骗局,那么很抱歉。
php7 ×13
php-fpm ×6
docker ×3
centos ×2
centos7 ×2
http ×2
linux ×2
php ×2
ubuntu-18.04 ×2
apache-2.4 ×1
apache2 ×1
downgrade ×1
fastcgi ×1
imagemagick ×1
mediawiki ×1
mysql ×1
nginx ×1
pcre ×1
redhat ×1
repository ×1
supervisord ×1
webmin ×1