Download big files from web to server over PHP without WGET or SSH Access

  • Create a new php file as “download.php” in a public directory with the above code in it.
  • Change the content of “$destination_folder” if needed.
  • Create a new folder to store the downloaded file as “downloads” in the same directory as of download.php.
  • Open the “download.php” file using browser and enter the location of file to be downloaded.
  • Download will begin in background.

Note: You may need to setup php.ini config file as per your need. For my 200MB file, I set max_execution_time = 90000, max_input_time = 90000 and memory_limit = 256M. In shared hosting environment, a php.ini file can be placed in “public_html” folder.


Why Asus India should improve it’s after-sales service

Facts and Figures:

  • Service Centre: Lotus Computech, Azadpur
  • RMA number: 7376425 => INJ9290004
  • Product Type : Notebook
  • Product Model : K53SC
  • Product S/N : B7N0AS142298273
  • Date of Purchase : 25/9/2011
  • Invoice Number: LSB-409917
  • Laptop Deposited in Service Centre: 8/9/2012
  • DOA Declared On: 1 October, 2012
  • DOA Certificate Number: ANN12ADL02011

I suffered from a horrible service experience with Asus India, it’s dealer and service centre and can safely declare it as the company which cares the least about it’s customers.

I purchased my first Asus product K53SC Notebook since at that time the machine was providing decent specifications in my budget. I didn’t know that I would suffer such a bad experience from Asus India guys in case of technical difficulties with my laptop.

The laptop visited service centre more than thrice for it’s motherboard power socket problem and once for LCD. Since my warranty expiration date was approaching I thought to appeal for the replacement of whole machine because I don’t want to suffer from this problematic machine outside the warranty period and incur expenses on it.

I called the toll free Asus customer care number, provided them with my notebook’s date of purchase and serial number. They registered my concern and forwarded it to the nearest service centre. I got a call from service centre and he asked me to come with my notebook so that he can show me the real mechanical defect in my machine. I visited and the problem was wasn’t any physical or accidental abuse, the service centre collected the laptop and gave me a receipt in exchange.

Almost 3 weeks after, i was issued a DOA (Dead on arrival)  certificate so that I can avail a replacement unit or a cash refund. I contact Modi Sales, Nehru Place, Delhi the same day and asked them the options available to me, they reverted back that my model is discontinued now and I can either choose a different model with similar specs or get an upgraded speced model and pay up the price different. I asked them to provide me only similar speced model, by that time because I already bought a different notebook Samsung NP550 i7 to keep up my work. Modi Sales asked me to wait for few days and since then I’m waiting.

I still did not get any replacement notebook. I need to them everytime myself and they didn’t care to contact me regarding the status or anything themselves.

My current model is discontinued and no other model nearby to it’s cost provide features like this and I don’t want to upgrade out of it and pay the difference. I wasn’t even provided to keep the hard drive for my precious data like financial files, project files etc.

I also requested many technical requests with ID=RWTM201209071455283675-762. [email protected] and [email protected] but in vain, they did not reply.

I am being called a computer guy by friends and families, they inquire with me everytime before buying any gadget and this experience would led to negative reviews from my side and a setback for my friends & family towards Asus products.

Update: As of Jan 22, 2013, I requested Modi Sales again for the replacement, they asked me to wait for 1 more week.

Update: As on June 15, 2013, Modi Sales provided me the replacement laptop K55VD-SX313R after I paid up the differentiating amount Rs.3500. My DOA case is closed now with Asus.

Clone and Copy a full laptop hard-drive for upgradation

My latest purchased laptop “Asus K53Sc” wasn’t doing good to me from quite a few months. The problem was with power socket on motherboard. The laptop was still under warranty and I requested a product replacement from Asus. The machine was my mainstream laptop and had all my data, very customized settings, customized softwares and more which I did not afford to loose.

That made me look for options to clone my existing hard drive in the current machine to my Western Digital external USB hard drive, so that I can reload the entire system as it is to my replacement laptop.

For me the best option is to use “Acronis True Image WD Edition Software” which is provided free of cost by WD since I already have a WD 1TB hard disk. In addition to that, I would also recommend backup from Windows built-in “System Backup and Restore“, just to be on safe side.

Another good yet free option would be to use a live cd or live drive with CloneZilla ( or Redo Backup and Recovery (


How to Use Clonezilla – Tutorial

How to backup your data for long term storage

For quite some time, I have been digging to find a reliable method to store my heavy personal media files which counts in GBs yet but is growing at a faster rate and soon gonna reach to a TB. And I pre-planned to off-load this data from my system’s hard disk.

Till now, I have looked into online cloud backup services like dropbox, RAID 1 NAS type storage, external hard drives and flash drives including SD cards. I am already using dropbox to store and backup my important files after activating two-factor authentication. Now it’s time to lookup a new house for my media files.

As far as i researched, I found optical storage devices like CDs and DVDs lasts longer but not more than Magnetic Tapes, which I think isn’t a reliable solution for personal needs keeping in view the future innovations. The key to store optical media for long time is maintenance and care.

The second best method, which I’m gonna try, is external hard drive. You may want to buy two hard drives each of different manufacturer (say one of Western Digital and other of Seagate) to justify your “backup” and sync the data every month. I would also recommend storing both the drives at different places in case some mishap like fire happen to one location.

Do handle the external USB powered hard drives with care. The more bumps you give it, the more will be the chances of getting it retire early.

Make sure you make duplicate copies of your critical data in several locations. Let me know if you any better alternative to my work-around.

Right now, cloud storage or redundant local storage (RAID) on active hard drives are much better backup options. Never keep one copy, always keep at least two.

Good Reads:


How to login into a server with “ssh friendly_name”

After moving to an Ubuntu environment after using windows for mote than 10 years, I feel like this is it. I used to use softwares like SecureCRT and Putty in the windows time but now I want to embed deeply into the linux environment for it’s simple yet powerful infrastructure.

At first I could login into my debian based server using “ssh -p22 [email protected]” after putting my private ssh key into the .ssh folder of my current user. But writing that long string every time was hectic and I’ve to find an easier alternative to do it.

After reading some ubuntu specific forums I came to know about host based login, which is useful even if you’re using multiple servers at a time and want to login randomly into each other. It works like defining the commands you want to pass in a ssh_config file (be it a system wide or user specific) only once and then you can use some friendly name to login into your server like “ssh my-server”.

User ssh_config File Location: ~/.ssh/ssh_config

System ssh_config File Location: /etc/ssh/ssh_config

Open the desirable config file and put in the following example configuration:

Host linode
Port 1234
User indude

You can find the list and descriptions of all parameters that can be specified in the host at

Securing PHP 5 Configuration File (php.ini)

PHP used to be the called the vulnerable script language around version 4 but since then a lot have been improved over the period with now my linux box using PHP 5.4 with built in test server. With thousands of websites and blogs writing to aware the php techies about common attacks and how to prevent them. Actually, the most common vulnerability as per me is “bad coding” techniques which may result in sql injections and xss kinda attacks.

Suhosin, a php plugin served well for few years but now It’s development is ceased for some reason. The package of php5.4 doesn’t come with suhosin anymore for the same reason.

Below are some techniques to secure or harden your php configuration from server side:

Note: A more preferred way will be to define a new ini file for every user as per the need rather then messing with the global php.ini.

short_open_tag = Off

asp_tags = Off

disable_functions = phpinfo,system,exec,shell_exec,passthru,popen,proc_open,parse_ini_file,show_source,symlink,curl_exec,curl_multi_exec

expose_php = Off

error_reporting = E_ALL

display_errors = Off

log_errors = On

ignore_repeated_errors = Off

report_memleaks = Off

open_basedir = “/home/user/websites:/tmp/”

upload_tmp_dir = /home/user/websites/.tmp

session.save_path = “/home/user/websites/.tmp”

error_log = /var/log/php-errors.log

post_max_size = 10M

default_charset = “UTF-8”

upload_max_filesize = 2M

allow_url_fopen = Off

Since this is my personal box, I restricted all eligible functions that can leak personal information or get exploited in other way.

You may also want to run a PHPSecInfo to verify the applied the missed settings.

How to easily use cron jobs in Linux

Cron Jobs in Linux

Linux Crontab Format

Table: Crontab Fields and Allowed Ranges (Linux Crontab Syntax)
Field Description Allowed Value
MIN Minute field 0 to 59
HOUR Hour field 0 to 23
DOM Day of Month 1-31
MON Month field 1-12
DOW Day Of Week 0-6
CMD Command Any command to be executed.

More at

Daemonize a bash script

I made a daemon process that runs all the time in background in my Debian 6 powered linux box. In this tutorial, I’m taking a example of bash script that I scripted as a temporarily fix to keep my php process up.

Enter the below code at the start of your existing bash script to create a PID a file every time it executes:

echo $$ > /var/run/;

Enter the below code at the end of your existing bash script to create run the code every 2 seconds using sleep command:

sleep 2;
/home/indude/ >/dev/null 2>&1 & exit 0;

In the above line, red colored code throws away any output and doesn’t output it whereas blue colored closes the script everytime it runs. The time is entered in seconds.

Now create a new script in /etc/init.d/ directory, say “phprestarter” (without any extension) and put the following content inside it.

#! /bin/sh
# /etc/init.d/phprestarter


/home/indude/ >/dev/null 2>&1 & exit 0;

case “$1” in
if [ -f $pid_file ]; then
echo “PHP Restarter already running.”
echo “Starting PHP Restarter.”
echo “PHP Restarter is started”
exit 1;
if [ -f $pid_file ]; then
echo “PHP Restarter is running.”
echo “PHP Restarter is stopped.”
echo “Restarting”
$0 stop
$0 start
echo “Restarted”
echo “Stopping PHP Restarter.”
if [ -f $pid_file ]; then
kill -KILL $(cat $pid_file);
rm -f $pid_file;
exit 0;
echo “PHP Restarter Stopped.”
echo “Usage: /etc/init.d/phprestarter {start|stop}”
exit 1;

exit 0;

Change the above code with your correct paths, script names etc.


PHP-FPM Error Solved: Failed to ptrace(PEEKDATA) pid: Input/output error

I got rid of the below error messages in my php5-fpm.log just after commenting out the below two lines in my pool.d/www.conf file.

Lines to comment

;slowlog = /var/log/php5-fpm/$pool.log.slow

;request_slowlog_timeout = 20s

Error Log:

[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 32076: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 32076
[01-Sep-2012 22:03:37] NOTICE: child 5377 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 5377
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 5377: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 5377
[01-Sep-2012 22:03:37] NOTICE: child 8990 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 8990
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 8990: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 8990
[01-Sep-2012 22:03:37] NOTICE: child 12402 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 12402
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 12402: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 12402
[01-Sep-2012 22:03:37] NOTICE: child 12403 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 12403
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 12403: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 12403
[01-Sep-2012 22:03:37] NOTICE: child 12570 stopped for tracing
[01-Sep-2012 22:03:37] NOTICE: about to trace 12570
[01-Sep-2012 22:03:37] ERROR: failed to ptrace(PEEKDATA) pid 12570: Input/output error (5)
[01-Sep-2012 22:03:37] NOTICE: finished trace of 12570

The stack trace (to determine what the script is doing) is failing. If you’re running out of processes, it is because either:

  1. After php-fpm stops the process to trace it, the process fails to resume because of the error tracing it
  2. The process is resuming but continues to run forever.

If this doesn’t fix the issue of running out of processes, then set the php.ini max_execution_time to something that will kill the script for sure.

Free SMS Sites for Text Messages to India

Everybody likes sending and receiving SMS, as it is the easiest and shortest way of communication. It tells you that you are cared and helps you in being touch with your buddies and close circle of people. In general the SMS costs less, compared to calling the people. Who will not be excited in knowing about the feature of sending the SMS at free of cost from the computer? What you need is a computer and an internet connection; now you will be connected to your friends and closed ones across the world. It has both advantages and disadvantages. It entirely depends upon you to check for the best websites in terms of usages and features. There are numerous websites offering free SMS services; no wonder, every day one such site is taking birth.

At this point of time, their objectives are questionable! What would they get in return, by offering such free SMS services? What is the use for them providing this service? If we pay close attention, then we can infer that they might get paid, via advertising other company’s products, and other information in their sites. There are numerous sites in this category and no doubts, regarding the fact that these sites would be search engine optimized sites; as a result, more and more advertisers would be willing to promote their products, via such sites. Such sites would be the cheapest medium for them to promote their advertisements. Some sites doesn’t stop by allowing these advertisers to use their site, rather, they allow these advertisers to send their advertisements and their promotional activities, via the SMS, which are being sent through parent SMS sites. Such advertisements would be attached at the end of the SMS.
If a person is registering in these sites for business activities, their contacts are used without their knowledge to send advertisements, other promotional activities and sometimes, even a message regarding a public happenings, or events. This would in turn irritate the person’s clients, customers and other users. Such SMS websites are also creating public nuisance. Recently, even the Indian government has announced such websites to hold the services, during the ‘Ayodhya verdict’ in order to avoid the swirling of unnecessary speculations in the country and to cease the problems that might otherwise raise form these SMS services, i.e. by sending bulk SMS in favor to a group of a religion might harm the other group.

Some sites are also promoting illegal ‘Multimedia Messaging Services’ via their services. All these are done to attract enormous number of customers to use their site. If their site is listed first in the search engines, such as ‘Google’, ‘Yahoo’,… then the advertisers who have promoted their products and services through these websites would also be listed in the first place, for which they would be charged accordingly. This has not only granted an easy means to communication and ecommerce activities, but has also invited problems and controversies at an easy means! If you enjoy the former event, then it is mandatory to enjoy the latter consequences too!