Nginx PHP(5.5.1)FPM奇怪的错误(Nginx PHP (5.5.1) FPM strange errors)
目前我正在试验Nginx。 我使用通过repo安装的最新版本工作。 Nginx独立版一切正常。 然后我通过源代码安装PHP 5.5.1,我可以运行不同的版本,而不是生产webserver和php版本。 (为了测试目的,Nginx在另一个端口上运行,然后是80.)
一切都很顺利。 编译PHP 5.5.1没有错误,安装它,启动PHP-FPM并更改Nginx配置以在需要时调用PHP FPM。 我的第一个测试网站与此版本完美配合。 然后我试图运行我创建的另一个网站。 我只更改了文档根目录。
然后我得到了非常奇怪的错误:
PHP Fatal error: Call to undefined function apache_request_headers() in [...]
是的,不是真正的错误......所以我删除了这个函数来测试网站是否能够在删除函数时顺利运行,这在PHP-FPM / FastCGI模式中是不可用的。
然后再次尝试时,日志中显示另一个错误:
PHP Parse error: syntax error, unexpected ''INSERT ' (T_ENCAPSED_AND_WHITESPACE) in [...]
注释掉此变量(仅用于测试)后发生另一个错误:
PHP Parse error: syntax error, unexpected end of file, expecting ')' in [...]
所以我不知道为什么会出现这两个错误。 第一个当然是改变了系统; 功能不可用。
所以我的主要问题是:为什么我的代码在FPM模式下使用PHP 5.5.1导致这些错误? 该网站完全适用于我的本地开发服务器(PHP 5.4和Apache)和生产服务器(Apache 2.2和PHP 5.4)...我没有更改代码(除了db等配置文件)。 有人知道会导致这个问题的原因吗?
如果您需要更多信息,请询问!
编辑:
错误1:
$sql = 'INSERT INTO ' . TABLE . ' (name) VALUES ("' . $name . '") ON DUPLICATE KEY UPDATE name=VALUES(name)';
错误2:
'TEXT' => text::parse($row['text']),
At the moment I'm experimenting with Nginx. I got it working using the newest version installed via repo. Everything works fine with Nginx standalone. Then I installed PHP 5.5.1 via sources that I can run different versions and not affection the production webserver and php version. (Nginx was running on another port then 80 for testing purposes.)
Everything went fine. Compiled PHP 5.5.1 without errors, installed it, started PHP-FPM and changed the Nginx config to call PHP FPM when needed. My first test website worked perfectly with this version. Then I tried to get running another website I created. I've changed only the document root for that.
Then I got very strange errors:
PHP Fatal error: Call to undefined function apache_request_headers() in [...]
Yes, not real an error... So I removed the function to test if the website works then smoothly when removing a function, which isn't available in PHP-FPM/FastCGI Mode.
Then another error showed in the logs when trying again:
PHP Parse error: syntax error, unexpected ''INSERT ' (T_ENCAPSED_AND_WHITESPACE) in [...]
After commenting out this variable (only for testing) another error occured:
PHP Parse error: syntax error, unexpected end of file, expecting ')' in [...]
So I don't know why those 2 errors occured. The first one is of course of the changed system; function not available.
So my main question is: Why is my code causing these errors with PHP 5.5.1 in FPM mode? The website works perfectly on my local dev server (PHP 5.4 and Apache) and production Server (Apache 2.2 and PHP 5.4)... I have NO code changed (except config files for db etc). So is someone knowing what can cause this issue?
If you need more information, just ask!
Edit:
Error 1:
$sql = 'INSERT INTO ' . TABLE . ' (name) VALUES ("' . $name . '") ON DUPLICATE KEY UPDATE name=VALUES(name)';
Error 2:
'TEXT' => text::parse($row['text']),
原文:https://stackoverflow.com/questions/18218446
最满意答案
不要尝试将事件绑定到循环结构中。
尝试,
$(document).ready(function () { $('.top').on('click', function () { $('.read').not($('.read:eq(' + $('.top').index(this) + ')').slideToggle(300)).slideUp(300); }); });
DEMO
Don't try to bind events inside a loop structure.
Try,
$(document).ready(function () { $('.top').on('click', function () { $('.read').not($('.read:eq(' + $('.top').index(this) + ')').slideToggle(300)).slideUp(300); }); });
DEMO
相关问答
更多-
不要尝试将事件绑定到循环结构中。 尝试, $(document).ready(function () { $('.top').on('click', function () { $('.read').not($('.read:eq(' + $('.top').index(this) + ')').slideToggle(300)).slideUp(300); }); }); DEMO Don't try to bind events inside a loop struct ...
-
toggle功能“内部使用点击事件”。 也就是说,它将函数绑定到单击事件,所以您也不需要调用click 。 尝试这个: $("#togglePanel").toggle(function(){ $("#orderMap").animate({marginLeft: 0, width: "100%"}, 500); }, function(){ $("#orderMap").animate({marginLeft: "341px", width: "576px"}, 500); }); Th ...
-
对于给定的要求,这是不可能的,所有元素都是div 。 如果你改变div作为锚点a链接,并使用:target伪,那就有可能 通过在锚点a上设置display: inline-block ,可以使用div它的大小 .clicker { display: inline-block; width: 100px; height: 50px; background-color: blue; color:#FFF; } .clicker.hidden { display: none ...
-
如果您只想沿垂直轴切换,请查看slideToggle功能。 If you just want to toggle along the vertical axis, take a look at the slideToggle function.
-
基于你的jQuery片段,我提出了 $(document).ready(function() { $('div.panel').css('left', '-200px'); $('a.panel').click(function() { var a = $(this); var p = $(a.attr('href')); var pw = p.width(); //-- if we have an active panel ...
-
你可以使用下面的代码片段: DEMO $(document).ready(function () { $("button").click(function () { this.toggle = !this.toggle; $("div").stop().fadeTo(400, this.toggle ? 0.4 : 1); }); }); 或者通常更好的解决方案是切换类: DEMO CSS: div { background-color: #ff00 ...
-
这是一个我认为更简单的例子。 它减少了DOM中元素的追加和删除: http://jsfiddle.net/4Mq3B/ $(document).ready(function () { $('.content').after('[Read More]'); $(".content").hide(); $('.toggle-link').click(function (e) { e.preventDe ...
-
jQuery切换Div切换器(jQuery Toggle Div Switcher)[2022-03-21]
我想这就是你所追求的: jQuery.fn.fadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle'}, speed, easing, callback); }; $(function() { $("#answer .views-row").hide(); $("#question .views-row").click(function(){ va ... -
尝试这样的事情,使用一个处理程序并根据条件切换。 $(document).on('click', function(e) { if ( $(e.target).is('.search_button') ) { $("#search").toggle("bounce", {direction: "up"}, 150); }else if ( $(e.target).closest('#search').length === 0 ) { $("#search ...
-
将第一个切换更改为hide()