Articles of PHP

清漆不能在PHP上使用会话

我的服务器上安装了清漆。 我在我的网站上有一个页面,我想通过清漆caching。 随着新鲜的清漆安装,我创build了一个PHP页面,其中的一些内容。 加载页面。 清漆工作正常。 但是,当我在该页面的第一行添加session_start()时,varnishcaching停止工作。 什么是清漆和PHP会话的问题? 任何人都可以帮忙

Nginx的:别名和try_files $ args

当我尝试在location /api/v1使用带有?$args try_files ,我得到错误404,没有它,它正常工作。 任何想法? Nginxconfiguration server { listen 80; server_name domain.com; index index.php; root /home/ec2-user/dev.domain.com.br/webroot/default/web; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; include fastcgi_params; } location /api/v1 { alias /home/ec2-user/dev.domain.com/webroot/apiv1/web; # Works, but don't parse args. try_files $uri /api/v1/index.php; ## << WORKING […]

清漆没有caching有会话的网站

我尝试curl -I domainname ,这里是响应。 HTTP/1.1 200 OK Date: Tue, 21 Apr 2015 14:49:09 GMT Server: Apache/2.2.15 (CentOS) X-Powered-By: PHP/5.3.3 Set-Cookie: PHPSESSID=kpgqqefkge38jlqc608hq12046; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Type: text/html; charset=UTF-8 X-Varnish: 294982 Age: 0 Via: 1.1 varnish-v4 Content-Length: 0 Connection: keep-alive HTTP/1.1 200 OK Date: […]

Nginx位置块 – 只匹配实际的文件

我有以下的nginxconfiguration: server { listen 8080; root /site_root/web; index index.html; server_name www.mysite.com; location / { try_files $uri @rewriteapp; } location @rewriteapp { rewrite ^(.*)$ /app.php/$1 last; } # add headers to static files location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|woff|ttf|eot)$ { expires 365d; add_header Pragma public; add_header Cache-Control "public"; } location ~ \.php { fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param PATH_TRANSLATED […]

在CentOS上PHP生成空白页面,没有错误

我的系统pipe理员使用CentOS,PHP和Apache来设置虚拟服务器。 所有似乎都正确安装:我得到了Apache的欢迎页面,我可以findPHP使用which php以及yum list installed *php* 。 我也可以把文件testing1.html放在/ var / www / html /中,并在浏览器上看到html内容。 但是当创build一个文件testing2.php包含<? phpinfo(); ?> <? phpinfo(); ?> <? phpinfo(); ?>我尝试通过浏览器访问它,并得到一个空白页。 Apache日志说 [23/Oct/2015:09:27:13 -0400] "GET /testing2.php HTTP/1.1" 200 16 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7" 这并不能帮助我弄清楚什么是错的。 文件夹权限是755,文件权限是644。 有关如何开始解决这个问题的任何build议?

在命令行上运行PHP引发关于SNMP的模块错误

当我在命令行上使用PHP运行任何命令时,我得到一堆关于模块的错误: vagrant@vagrant-ubuntu-trusty-64:~$ php -v MIB search path: /home/vagrant/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp Cannot find module (SNMPv2-TC): At line 10 in /usr/share/snmp/mibs/UCD-DLMOD-MIB.txt Cannot find module (SNMPv2-SMI): At line 34 in /usr/share/snmp/mibs/UCD-SNMP-MIB.txt Cannot find module (SNMPv2-TC): At line 37 in /usr/share/snmp/mibs/UCD-SNMP-MIB.txt Did not find 'enterprises' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt) Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt) Did not find 'TruthValue' […]

PHP-FPM偶尔会出现“FastCGI:无法连接到服务器”的错误

Ubuntu 14.04.3 LTS Apache 2.4.7 PHP 5.5.9 两周前我从mod_php切换到了PHP-FPM。 一切,大部分运行顺利。 除了现在两次我有一个情况下,Apache / PHP将变得没有反应。 重启会解决这个问题,但是我想知道为什么会发生这种情况。 这里是错误日志,其中充满了数百种类似的错误。 # /var/log/apache2/error.log . . [Wed Dec 16 23:19:21.476641 2015] [fastcgi:error] [pid 32523] (104)Connection reset by peer: [client xx.xx.xx.xx:43676] FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi" aborted: read failed [Wed Dec 16 23:19:21.476866 2015] [fastcgi:error] [pid 32411] (2)No such file or directory: [client xx.xx.xx.xx:63082] […]

如何在CentOS 7.2上将PHP升级到5.6.x或7.0.x?

我在使用PHP 5.4.16的CentOs 7.2上。 我想更新到PHP 5.6.x或者甚至PHP 7.0.x如果安全的话。 什么是安全切换到一个新的PHP版本的步骤? 这些是与PHP相关的安装包: php.x86_64 5.4.16-36.el7_1 @updates php-bcmath.x86_64 5.4.16-36.el7_1 @updates php-cli.x86_64 5.4.16-36.el7_1 @updates php-common.x86_64 5.4.16-36.el7_1 @updates php-fpm.x86_64 5.4.16-36.el7_1 @updates php-gd.x86_64 5.4.16-36.el7_1 @updates php-intl.x86_64 5.4.16-36.el7_1 @updates php-mbstring.x86_64 5.4.16-36.el7_1 @updates php-mysql.x86_64 5.4.16-36.el7_1 @updates php-pdo.x86_64 5.4.16-36.el7_1 @updates php-pear.noarch 1:1.9.4-21.el7 @base php-process.x86_64 5.4.16-36.el7_1 @updates php-xml.x86_64 5.4.16-36.el7_1 @updates

Shibboleth – 保护整个IIS应用程序

我在服务器上安装了shibboleth SP ,现在我想保护我的IIS文件夹。 我遵循了几个教程,并在我的shibboleth2.xml文件中使用了这个语法: <RequestMapper type="Native"> <RequestMap applicationId="default"> <Host name="mydomain" redirectToSSL="443"> <Path name="secure" authType="shibboleth" requireSession="true" /> </Host> </RequestMap> </RequestMapper> 现在mydomain.tld/secure被shibboleth保护,工作正常。 我如何保护根文件夹和其中的每个孩子? 我在webapp的根目录下使用了一个PHP应用程序,同时我也使用了几个URLRewrite规则来redirect像: frontpage/item/123到: index.php?t=frontpage/item&id=123 。 我怎样才能保护index.php和可能所有的子文件夹

在nginx上清理URL和php扩展

我已经看了网上的其他几十个问题和参考 – 而且通过我所有的计算,我的设置应该可以工作,但是不能。 我有php-fpm的nginx安装。 如果我尝试访问一个.php文件,它运行正确,我得到正确的结果。 我在我的configuration文件中得到这个: location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } 现在,我想设置我的networking应用程序,以便/somedir/file自动执行/somdir/file.php同时仍然在浏览器的地址栏中显示/somdir/file 。 所以我修改我的configuration来包含以下内容: location / { try_files $uri $uri/ $uri.php?query_string } 这种工作,也就是服务器访问.php文件。 然而,不是使用上面现有location ~ \.php$块来执行它,而只是将php源代码作为下载到浏览器中。 如果我手动追加.php到所请求的URL,那么PHP被执行。 感觉就好像服务器把try_files和$uri.php匹配$uri.php ,然后就不会在位置做另一个传递来看看它需要做什么。 我试图把php块放在location /上面和下面,但是没有什么区别。 我怎样才能得到执行的PHP?