Halo, untuk mempercepat download suatu file dari lokasi remote anda bisa gunakan script php berikut ini.

<?php

/**
* Copy remote file over HTTP one small chunk at a time.
*
* @param $infile The full URL to the remote file
* @param $outfile The path where to save the file
*/
function copyfile_chunked($infile, $outfile) {
$chunksize = 10 * (1024 * 1024); // 10 Megs

/**
* parse_url breaks a part a URL into it's parts, i.e. host, path,
* query string, etc.
*/
$parts = parse_url($infile);
$i_handle = fsockopen($parts['host'], 80, $errstr, $errcode, 5);
$o_handle = fopen($outfile, 'wb');

if ($i_handle == false || $o_handle == false) {
return false;
}

if (!empty($parts['query'])) {
$parts['path'] .= '?' . $parts['query'];
}

/**
* Send the request to the server for the file
*/
$request = "GET {$parts['path']} HTTP/1.1\r\n";
$request .= "Host: {$parts['host']}\r\n";
$request .= "User-Agent: Mozilla/5.0\r\n";
$request .= "Keep-Alive: 115\r\n";
$request .= "Connection: keep-alive\r\n\r\n";
fwrite($i_handle, $request);

/**
* Now read the headers from the remote server. We'll need
* to get the content length.
*/
$headers = array();
while(!feof($i_handle)) {
$line = fgets($i_handle);
if ($line == "\r\n") break;
$headers[] = $line;
}

/**
* Look for the Content-Length header, and get the size
* of the remote file.
*/
$length = 0;
foreach($headers as $header) {
if (stripos($header, 'Content-Length:') === 0) {
$length = (int)str_replace('Content-Length: ', '', $header);
break;
}
}

/**
* Start reading in the remote file, and writing it to the
* local file one chunk at a time.
*/
$cnt = 0;
while(!feof($i_handle)) {
$buf = '';
$buf = fread($i_handle, $chunksize);
$bytes = fwrite($o_handle, $buf);
if ($bytes == false) {
return false;
}
$cnt += $bytes;

/**
* We're done reading when we've reached the conent length
*/
if ($cnt >= $length) break;
}

fclose($i_handle);
fclose($o_handle);
return $cnt;
}

copyfile_chunked('http://domain.com/namafile.zip', 'namafile.zip');
?>

Contoh diatas akan mendownload file wordpress terbaru dan akan menyimpan di hosting anda.

Selamat mencoba.

 

 

Apabila terlalu banyak email frozen di directadmin, maka anda bisa menghapusnya secara otomatis dengan menggunakan penjadwalan cron.

Jalankan peritah ini :

<strong> exim -bp|grep frozen|awk '{print $3}' |xargs exim -Mrm</strong>

atau ini

<strong># exiqgrep -zi|xargs exim -Mrm</strong>

Selamat mencoba.

 

 

 

 

Bila anda ingin melakukan copy file antar server menggunakan ssh atau rsync dan tanpa mau ditanyai password lagi. Ikuti cara ini:

Buat Public Key

ssh-keygen -f ~/.ssh/id_rsa -q -P ""
cat ~/.ssh/id_rsa.pub

Copy public key tersebut ke server tujuan dan simpan pada path ~/.ssh/authorized_keys

dan jika folder tersebut belum tercipta, maka di server tujuan buatlah foldernya.

mkdir ~/.ssh
chmod 0700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 0644 ~/.ssh/authorized_keys

Pengujian Rsync atau SSH

Selanjutnya lakukan pengujian login dengan ssh atau mengcopykan file menggunakan rsync.

ssh -p 22 root@server.com

atau anda bisa coba rsync dengan cara

rsync -avz --progress /folder/namafile.tar.gz -e  "ssh -p 322" root@server.com:~/

Selamat mencoba dan apabila ada masalah / kesulitan silahkan tanya saja dengan meninggalkan komentar dibawah.

 

Hari ini kami mendapati error mysql seperti ini “Mysql Can’t Open file …. [ERROR] Error in accept: Too many open files”

 

Setelah mencari solusi akhirnya menemukan solusi dari dauntuk.com

dan berikut ini yang kami lakukan.

nano /etc/security/limits.conf

kemudian sesuaikan seperti dibawah

# End of file
soft nofile 1024000
hard nofile 1024000
soft nproc 1024000
hard nproc 1024000
mysql hard nofile 1024000
mysql soft nofile 1024000

nano /etc/security/limits.d/90-nproc.conf

*          soft    nproc     10240000
root       soft    nproc     unlimited
mysql   soft    nproc   10240000

dan yang terakhir merubah setting my.cnf

nano /etc/my.cnf

kemudian tambahkan

[mysqld]
open_files_limit = 1024000

dan restart mysqlnya

 

Hari ini ada gangguan listrik yang mengakibatkan server langsung mati dan membuat rusak kuota node vps dengan error seperti ini

Initializing quota …
vzquota : (error) Quota on syscall for id 101: File exists
vzquota : (error)       Native quota is already running for this partition.
vzquota on failed [3]

Solusinya adalah dengan mendisable sistem kuota

nano /etc/sysconfig/vz

ubah DISK_QUOTA=yes ke DISK_QUOTA=no dan jalankan kembali vps satu per satu.

Cara ini berhasil namun vps berjalan tanpa sistem kuota, selanjutnya kami cari cara untuk mengaktifkan kembali sistem kuota tersebut.

Demikian catatan ini, semoga membantu.