PHP Run Background Process using Exec

If you need to start process in background and get its PID to manage it later using PHP. <?php function runInBackground($command,$log,$priority=0) { if($priority)    $PID=shell_exec(“nohup nice -n $priority $command > $log 2>&1 & echo $!”); else    $PID=shell_exec(“nohup $command > $log 2>&1 & echo $!”); return($PID); } ?> echo $! will return process ID # Command & … Read more

How to prevent downloading and leeching media files

How Do I Stop Hotlinking, Bandwidth Theft, Downloading and Leeching media files? You can stop downloading / hotlinking / leeching your site’s files using .htaccess in your Apache root or directory. The Apache mod_rewrite must be enabled for this. The 1st line of the above code begins the rewrite. The 2nd line matches any requests … Read more

How to clean malware from website?

Malware, short for malicious software, is a software designed to secretly access a computer system without the owner’s informed consent. The expression is a general term used by computer professionals to mean a variety of forms of hostile, intrusive, or annoying software or program code. Sucuri SiteCheck is a free & remote scanner. SCAN Website … Read more

UTF-8 FTP Tools

FTP Tools / Clients are most useful for transferring files and data to server. There are many FTP clients used in File Transfer, please use wikipedia.org for more details… http://en.wikipedia.org/wiki/Comparison_of_FTP_client_software Some time file transfer is not secure and reliable using various tools, file become corrupted or some special characters added to files. You have to use UTF8 encoding … Read more

Open source – Port25

If you have trouble getting the PHP’s mail() function to work on your server. If the function returned true, but never send the emails to target account. Some ISP’s block port 25 (mail port), so you can’t send directly but you can send indirectly using your ISP’s mail server. 😉 Many email providers keep lists … Read more

Install geoip on xampp

Geocoding (finding latitude/longitude for street addresses), Geotagging (tagging media with latitude/longitude coordinates), and Geolocation (finding latitude/longitude of computer with IP X-Forwarded-For). There are some options to install on linux environment: # wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz # gunzip GeoLiteCity.dat.gz # sudo mkdir -v /usr/share/GeoIP # sudo mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat Install geoip with php5 # sudo apt-get install … Read more

How to run cronjobs per second?

Have you checked my previous article on cronjobs… https://www.svnlabs.com/blogs/tag/crontab-command-line/ To run cronjob per second you have to execute crontab/cronjob per minute and then have to run task in cron file per second using PHP function time_sleep_until(). <?php $start = microtime(true); for($ii=0;$ii<60;$ii++) { //………………………. /// here is the tasks which need to run per second… //………………………. … Read more

Image2text

Image to Text Or Optical Character Recognition (OCR) is used for extracting text from PDF and images (JPG, BMP, TIFF, GIF) and convert into editable Word, Excel and Text output formats. What is OCR? Optical Character Recognition (OCR) is process of converting scanned images of handwritten, typed, or printed text into machine-encoded text. It is … Read more