简体   繁体   English

PHP会话无法加载? 内存问题?

[英]PHP session won't load? Memory issue?

I have a page that allows you to input customer information, which sends to a page to process information. 我有一个页面,允许您输入客户信息,该页面发送到页面以处理信息。 If the information is correct, it is recorded to the database. 如果信息正确,则将其记录到数据库中。 Any incomplete information is sent to another page to be modified. 任何不完整的信息将发送到另一个页面进行修改。 The incomplete information is stored in a $_SESSION array ex $CustomerEntry[$LineCount][$CellCount]. 不完整的信息存储在$ CustomerEntry [$ LineCount] [$ CellCount]之前的$ _SESSION数组中。 It seems when the array gets over a certain size, the correction page is never loaded. 似乎当数组超过一定大小时,永远不会加载校正页面。 It stalls on the process page. 它停在进程页面上。

I have unset any unneeded variables. 我没有设置任何不需要的变量。 Checked the amount of memory allowed to be used by the server and that specific page. 检查服务器和该特定页面允许使用的内存量。 The largest entry I have gotten to go to that page so far has been $LineCount of 5 and $CellCount of 9, anything more than that stalls. 到目前为止,我进入该页面的最大条目是$ LineCount为5和$ CellCount为9。

What can I do to possible fix this? 我该怎么做才能解决此问题?

I've never heard of such an issue. 我从未听说过这样的问题。 Try 尝试

error_reporting(E_ALL);
ini_set('display_errors','On');

to make sure that there are no other problems. 确保没有其他问题。 Put this to your processing php file. 将此放入您正在处理的php文件。

Assuming you're using the standard PHP file-based sessions, you can get a rough idea of how big the session file is by doing: 您正在使用标准的PHP基于文件的会话假设,你可以得到的会议文件有多大是做一个粗略的想法:

$session_file = session_save_path() . '/sess_' . session_id();
echo(filesize($session_file));

On most systems, that should spit out the size of the session file in bytes. 在大多数系统上,这应该吐出会话文件的大小(以字节为单位)。 Note that it's stored in serialized form, so the on-disk size will be slightly different than what it'd be if you loaded up the session. 请注意,它以序列化形式存储,因此磁盘大小将与加载会话时的大小略有不同。

However, if the session file was too big to start with, you wouldn't get half-way into your code and then die - it'd die right at the moment you did a session_start() , and would also bring into question how the session could get that big to start with. 但是,如果会话文件太大而无法开始,那么您就不会半途而废了,然后就死掉了-它在您执行session_start()的那一刻就死掉了,并且还会引起人们的疑问会议可能会开始那么大。 If it's too big to read in, it should have been too big to fit into memory originally. 如果太大而无法读取,则它本来应该太大而无法放入内存中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM