最后我用下面两行重现了这个问题:
session_set_save_handler(new SessionHandler());
session_start();
当我这样做时,我得到了 WSOD!知道为什么会这样吗?
============================================= =============
最后,我越挖越深,将范围缩小到由于 session_start() 失败而导致的问题;不过,我不知道为什么会那样失败。
所以,问题归结为:
当在 NativeSessionStorage::start() 中调用 session_start() 时,它会失败。但是,当我创建一个仅执行 session_start() 的示例测试页时,它成功了!
Silex 有什么不同之处吗?!
我保留下面的文字,以便遇到类似问题的任何人都能理解失败背后的原因。
============================================= =============
我最近尝试从 Php 5.3 切换到 Php 5.4,但我基于 Silex 的网站停止使用 WSOD。
我检查了 PHP 错误日志,发现:
脚本头过早结束:php54.cgi
我尝试了很多东西,最后想到了在线询问 :(。以下是我的尝试:
在初始化 Silex 之前添加代码并在之后设置 app[debug] = true:
ini_set('display_errors', 1);
error_reporting(-1);
ErrorHandler::register();
if ('cli' !== php_sapi_name()) {
ExceptionHandler::register();
}
尝试检查代码的运行范围。但我一直在介入。我一直走到 NativeSessionStorage::start() 并放弃,所以它一直工作到那时,我在那里生成的任何错误都按预期正确报告。
尝试查看其他条目以了解如何修复蓝屏死机,但没有一个真正解释从 PHP 5.3 迁移到 PHP 5.4 会发生什么变化!这就是我所做的一切。只是相应地更改了 PHP 版本和 PHP.INI。下面是我现在使用的PHP.INI。
; |PIG v0.3.2.1|
[PHP]
open_basedir =
engine = 1
zend.ze1_compatibility_mode =
short_open_tag = 1
asp_tags =
precision = 14
y2k_compliance = 1
output_buffering = 4096
zlib.output_compression =
implicit_flush =
unserialize_callback_func =
serialize_precision = 100
allow_call_time_pass_reference =
safe_mode =
; safe_mode_gid = 1
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = "PHP_"
safe_mode_protected_env_vars = "LD_LIBRARY_PATH"
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,show_source
disable_classes =
highlight.string = "#DD0000"
highlight.comment = "#FF9900"
highlight.keyword = "#007700"
highlight.bg = "#FFFFFF"
highlight.default = "#0000BB"
highlight.html = "#000000"
expose_php = 1
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = 6135
display_errors = 1
display_startup_errors =
log_errors = 1
log_errors_max_len = 1024
ignore_repeated_errors =
ignore_repeated_source =
report_memleaks = 1
track_errors =
html_errors =
error_log = "/hsphere/local/var/httpd/logs/php54_error.log"
variables_order = EGPCS
register_globals = 0
; register_long_arrays = 1
register_argc_argv = 1
auto_globals_jit = 1
post_max_size = 30M
; magic_quotes_gpc = 1
magic_quotes_runtime =
magic_quotes_sybase =
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
always_populate_raw_post_data = 1
;***** Added by go-pear
include_path=".:/hsphere/shared/php54/include/php/PEAR"
;*****
doc_root =
user_dir =
extension_dir = "/hsphere/shared/php54/lib/php/extensions/no-debug-non-zts-20100525/"
cgi.fix_pathinfo = 1
file_uploads = 1
upload_tmp_dir =
upload_max_filesize = 25M
allow_url_fopen = 1
allow_url_include =
default_socket_timeout = 60
auto_detect_line_endings = 1
[Syslog]
define_syslog_variables =
[mail function]
sendmail_path = /usr/sbin/sendmail -t -i -fpostmaster@example.com
mail.force_extra_parameters =
[SQL]
sql.safe_mode =
[ODBC]
odbc.allow_persistent =
odbc.check_persistent = 1
odbc.max_persistent = "-1"
odbc.max_links = "-1"
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[MySQL]
mysql.allow_persistent =
mysql.max_persistent = "-1"
mysql.max_links = "-1"
mysql.default_port = 3306
mysql.default_socket = "/var/lib/mysql/mysql.sock"
mysql.default_host = localhost
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode =
[MySQLi]
mysqli.max_links = "-1"
mysqli.default_port = 3306
mysqli.default_socket = "/var/lib/mysql/mysql.sock"
mysqli.default_host = localhost
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect =
[PostgresSQL]
pgsql.allow_persistent =
pgsql.auto_reset_persistent =
pgsql.max_persistent = "-1"
pgsql.max_links = "-1"
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[dbx]
dbx.colnames_case = lowercase
[bcmath]
bcmath.scale = 0
[Session]
session.save_handler = files
session.save_path = "${US_ROOTF}/tmp"
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[Assertion]
assert.active = 1
assert.warning = 1
assert.bail =
assert.callback = 0
assert.quiet_eval = 0
[Sockets]
sockets.use_system_read = 1
[mbstring]
mbstring.language = Neutral
mbstring.internal_encoding = "EUC-JP"
mbstring.http_input = pass
mbstring.http_output = pass
mbstring.encoding_translation =
mbstring.detect_order = auto
mbstring.substitute_character =
mbstring.func_overload = 0
[exif]
exif.encode_unicode = "ISO-8859-15"
exif.decode_unicode_motorola = "UCS-2BE"
exif.decode_unicode_intel = "UCS-2LE"
exif.encode_jis =
exif.decode_jis_motorola = JIS
exif.decode_jis_intel = JIS
[soap]
soap.wsdl_cache_enabled = 1
soap.wsdl_cache_dir = "/tmp"
soap.wsdl_cache_ttl = 86400
[Zend]
zend_extension="/hsphere/shared/php54/lib/php/extensions/ZendGuardLoader.so"
; zend_extension_manager.optimizer = "/usr/local/Zend/lib/Optimizer-3.3.3"
; zend_extension_manager.optimizer_ts = "/usr/local/Zend/lib/Optimizer_TS-3.3.3"
; zend_optimizer.version = "3.3.3"
; zend_extension = "/usr/local/Zend/lib/ZendExtensionManager.so"
; zend_extension_ts = "/usr/local/Zend/lib/ZendExtensionManager_TS.so"
[suhosin]
; extension = suhosin.so
suhosin.executor.include.max_traversal = 4
suhosin.executor.disable_emodifier = 0
suhosin.executor.include.whitelist = "http://,https://,file://,bfa://"
suhosin.executor.allow_symlink = 0
suhosin.mail.protect = 1
suhosin.upload.disallow_elf = 1
suhosin.log.syslog = 511
suhosin.log.syslog.facility = 8
suhosin.log.syslog.priority = 1
suhosin.log.sapi = 511
suhosin.session.encrypt = 0
suhosin.cookie.cryptua = 0
suhosin.session.cryptdocroot = 0
suhosin.cookie.cryptdocroot = 0
suhosin.executor.include.whitelist="phar"
suhosin.get.max_value_length = 10240
[curl]
extension=curl.so
[gmp]
extension=gmp.so
[iconv]
extension=iconv.so
[imap]
extension=imap.so
[mysqli]
extension=mysqli.so
[mysql]
extension=mysql.so
[odbc]
extension=odbc.so
[pdo]
extension=pdo.so
[pdo_mysql]
extension=pdo_mysql.so
[pdo_pgsql]
extension=pdo_pgsql.so
[pdo_sqlite]
extension=pdo_sqlite.so
[pgsql]
extension=pgsql.so
[sqlite3]
extension=sqlite3.so
[htscanner]
extension=htscanner.so
[mongo]
extension=mongo.so
[date]
date.timezone=EST
我使用了我的主机账户控制面板提供的工具来进行切换,所以我很确定它一定是正确的。我能够运行其他 PHP 脚本。
最佳答案
我想我以前也遇到过同样的问题。如果您使用的 PHP 版本 < 5.4.11="" -="" sessionhandler="" 实现中存在错误="" -="" 检查此="">link出来,也许它有某种关系......
关于php - 由于 "session_start",从 PHP 5.3 切换到 Php 5.4 时 Silex 出现白屏死机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27159326/
我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar
我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test
我正在尝试从Postgresql表(table1)中获取数据,该表由另一个相关表(property)的字段(table2)过滤。在纯SQL中,我会这样编写查询:SELECT*FROMtable1JOINtable2USING(table2_id)WHEREtable2.propertyLIKE'query%'这工作正常:scope:my_scope,->(query){includes(:table2).where("table2.property":query)}但我真正需要的是使用LIKE运算符进行过滤,而不是严格相等。然而,这是行不通的:scope:my_scope,->(que
我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file
当我尝试安装Ruby时遇到此错误。我试过查看this和this但无济于事➜~brewinstallrubyWarning:YouareusingOSX10.12.Wedonotprovidesupportforthispre-releaseversion.Youmayencounterbuildfailuresorotherbreakages.Pleasecreatepull-requestsinsteadoffilingissues.==>Installingdependenciesforruby:readline,libyaml,makedepend==>Installingrub
我在新的Debian6VirtualBoxVM上安装RVM时遇到问题。我已经安装了所有需要的包并使用下载了安装脚本(curl-shttps://rvm.beginrescueend.com/install/rvm)>rvm,但以单个用户身份运行时bashrvm我收到以下错误消息:ERROR:Unabletocheckoutbranch.安装在这里停止,并且(据我所知)没有安装RVM的任何文件。如果我以root身份运行脚本(对于多用户安装),我会收到另一条消息:Successfullycheckedoutbranch''安装程序继续并指示成功,但未添加.rvm目录,甚至在修改我的.bas
下面的代码在我第一次运行它时就可以正常工作:require'rubygems'require'spreadsheet'book=Spreadsheet.open'/Users/me/myruby/Mywks.xls'sheet=book.worksheet0row=sheet.row(1)putsrow[1]book.write'/Users/me/myruby/Mywks.xls'当我再次运行它时,我会收到更多消息,例如:/Library/Ruby/Gems/1.8/gems/spreadsheet-0.6.5.9/lib/spreadsheet/excel/reader.rb:11
我正在学习Ruby的基础知识(刚刚开始),我遇到了Hash.[]method.它被引入a=["foo",1,"bar",2]=>["foo",1,"bar",2]Hash[*a]=>{"foo"=>1,"bar"=>2}稍加思索,我发现Hash[*a]等同于Hash.[](*a)或Hash.[]*一个。我的问题是为什么会这样。是什么让您将*a放在方括号内,是否有某种规则可以在何时何地使用“it”?编辑:我的措辞似乎造成了一些困惑。我不是在问数组扩展。我明白了。我的问题基本上是:如果[]是方法名称,为什么可以将参数放在括号内?这看起来几乎——但不完全是——就像说如果你有一个方法Foo.d