- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
真的很想得到一些帮助。
在上传 75mb 的大文件时,我不断收到错误 Mysql has gone away。任何低于 20mb 的内容都可以上传。
所以我已经在此处的其他帖子中调查了此错误。我在媒体殿堂,但不幸的是,他们说这超出了他们的范围。
我已经在/etc/my.cnf 编辑了这个文件 my.cnf
[client]
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
innodb_buffer_pool_size=2M
innodb_additional_mem_pool_size=500K
innodb_log_buffer_size=500K
innodb_thread_concurrency=2
[mysqld]
local-infile=0
datadir=/var/lib/mysql
user=mysql
symbolic-links=0
max_connections = 150
wait_timeout = 600
query-cache-type = 1
query-cache-size = 16M
query_cache_limit = 2M
thread_cache_size = 16
tmp_table_size = 32M
max_heap_table_size = 32M
join_buffer_size = 2M
table_open_cache = 128
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_buffer_size = 8M
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
所以我已经将等待超时部分增加到 600,这应该足够了?
我的 php.ini 文件设置如下。
[PHP]
soap.wsdl_cache_limit = 5
include_path = ".:"
cli_server.color = On
mysql.allow_persistent = On
mysqli.max_persistent = -1
session.bug_compat_42 = Off
mysql.connect_timeout = -1
session.use_only_cookies = 1
register_argc_argv = Off
mssql.min_error_severity = 10
open_basedir = "/var/www/vhosts/s3bubble.com/:/tmp/"
session.name = PHPSESSID
mysqlnd.collect_statistics = On
session.hash_function = 0
session.gc_probability = 1
log_errors_max_len = 1024
mssql.secure_connection = Off
pgsql.max_links = -1
variables_order = "GPCS"
ldap.max_links = -1
sybct.allow_persistent = On
max_input_time = 600
odbc.max_links = -1
session.save_handler = files
mysqli.cache_size = 2000
pgsql.auto_reset_persistent = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
auto_prepend_file =
sendmail_path = /usr/sbin/sendmail -t -i
sybct.min_client_severity = 10
pgsql.max_persistent = -1
auto_globals_jit = On
soap.wsdl_cache_ttl = 86400
allow_url_fopen = On
zend.enable_gc = On
mysqli.allow_persistent = On
tidy.clean_output = Off
display_startup_errors = Off
user_dir =
session.cookie_lifetime = 0
mysqli.max_links = -1
default_socket_timeout = 900
session.serialize_handler = php
session.hash_bits_per_character = 5
unserialize_callback_func =
pdo_mysql.cache_size = 2000
default_mimetype = "text/html"
session.cache_expire = 180
max_execution_time = 600
mail.add_x_header = On
upload_max_filesize = 1G
ibase.max_links = -1
safe_mode = off
zlib.output_compression = Off
ignore_repeated_errors = Off
odbc.max_persistent = -1
mssql.compatability_mode = Off
file_uploads = On
所以我已经提高了超时任何帮助这让我发疯任何任何建议
这是脚本;
public function Uploader()
{
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$targetDir = $_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $this->session->userdata('account_id') . '/folder/' . $_REQUEST['playlist_id'];
if (!file_exists($targetDir)) {
mkdir($targetDir, 0777);
}
// Get parameters
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
// Clean the fileName for security reasons
$fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
// Make sure the fileName is unique but only if chunking is disabled
if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
$ext = strrpos($fileName, '.');
$fileName_a = substr($fileName, 0, $ext);
$fileName_b = substr($fileName, $ext);
$count = 1;
while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName_a . '_' . $count . $fileName_b)) {
$count++;
}
$fileName = $fileName_a . '_' . $count . $fileName_b;
}
$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
// Create target dir
if (!file_exists($targetDir)) {
@mkdir($targetDir);
}
// Look for the content type header
if (isset($_SERVER["HTTP_CONTENT_TYPE"])) {
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
}
if (isset($_SERVER["CONTENT_TYPE"])) {
$contentType = $_SERVER["CONTENT_TYPE"];
}
// Handle non multipart uploads older WebKit versions did not support multipart in HTML5
if (strpos($contentType, "multipart") !== false) {
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
// Open temp file
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen($_FILES['file']['tmp_name'], "rb");
if ($in) {
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
}
fclose($in);
fclose($out);
@unlink($_FILES['file']['tmp_name']);
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
}
} else {
// Open temp file
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen("php://input", "rb");
if ($in) {
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
}
fclose($in);
fclose($out);
} else {
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
}
// Check if file has been uploaded
if (!$chunks || $chunk == $chunks - 1) {
$response = shell_exec("cd {$targetDir}/ && runs some script here 2>&1");
$data = array(
'filename' => $fileName,
);
if ($response) {
//Add values to database
$this->uploader_model->addFileData($data);
}
}
}
最佳答案
请增加wait_timeout的时间
Two possible reasons may be:-
- Server timed out and closed the connection. How to fix: check that wait_timeout variable in your mysqld’s my.cnf/my.ini configuration file is large enough.
- Server dropped an incorrect or too large packet. If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. You can increase the maximal packet size limit by increasing the value of max_allowed_packet in my.cnf/my.ini file.
关于Mysql 已经消失了 media temple,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18315130/
我正在使用插件 jquery-tmpl .有没有办法在模板运行后指定回调?我想做类似的事情 ${content} ${processItem($('#' + timestam
真的很想得到一些帮助。 在上传 75mb 的大文件时,我不断收到错误 Mysql has gone away。任何低于 20mb 的内容都可以上传。 所以我已经在此处的其他帖子中调查了此错误。我在
帮助, 我注意到 media temple .net 使用以容器为中心的内容处理其响应式主页的一种很酷的方式,但是当您向下滚动时有两个部分,图像全宽超过容器。我无法在我正在处理的网站上复制它。 这是一
您知道《Temple Run》有时会在您打开应用程序时出现警报,即使您没有更新应用程序吗?我了解如果您要提交应用程序更新,您将如何实现这一点,但是 Imangi 如何在不发布新版本应用程序的情况下实现
我有一个已经安装了 git 的 Media Temple 服务器。如何从我在 GitHub 上托管的存储库克隆文件? 最佳答案 这可能类似于在 Media Temple 服务器上克隆一个托管在 Unf
我正在查看动态数组,但不确定“对象”意味着什么 protected void resize (int capacity) { E[] temp = (E[]) new Object[capacity]
我正在尝试让一些 SKShapeNode 看起来像是从远处看起来离用户越来越近。这是我到目前为止所拥有的: 我正在做的是随着时间的推移缩放形状节点,并对它们应用 imuplse。问题是它们看起来并没有
我的 CakePHP 应用程序中有以下 Shell: from('cameron@driz.co.uk'); $email->to('cameron@driz.co.uk');
iOS 尚不支持 WebGL,我需要为 iOS 编写类似 Temple Run 的 3D 游戏。是否可以在普通的 Canvas 中编写这样的游戏?或者我应该放弃吗? 谢谢。 最佳答案 就我个人而言,我
我有这个代码 - value="true" - if (value) p yes #if the condition is true I want to insert a glyphicon. (
我不确定将其发布到哪里,所以我认为这可能是个好地方。我想知道是否可以让 Heroku 应用程序的 DATABASE_URL 指向 Media Temple GS 数据库?我已经尝试使用以下命令建立与我
我真的被这个问题难住了。尝试在我的 mediatemple DV 4.0 服务器上使用 php 连接到 MS-SQL 数据库。 使用这些说明,我能够让它在我们的 DV 3.5 上运行 http://k
我希望有人能立即知道这个问题的答案。我在 Fedora 盒子上开发了这个网站,然后将其移至运行 Ubuntu Svr 10.10/Apache2/PHP5/MySQL5.1 的测试盒子(下面的链接),
我在我的网站上设置了一个简单的表单来测试使用 PHP 发送电子邮件。 表单将三个文本字段的输入发送到 email-form-process.php,如下所示: 我在测试中回显了三个输入,以确保 em
我从上面得到这个错误,不知道如何避免它。我的目的是获取屏幕截图,然后对其进行模板匹配,以查看此时屏幕上是否显示图标。到目前为止,它只是图标的位置。我的代码: #include "opencv2/hig
我是一名优秀的程序员,十分优秀!