Create FTP user from SSH

Wow! amazing …… Do you want to create FTP user from linux command line SSH? First you have to install FTP daemon like vsftpd: http://www.cyberciti.biz/tips/linux-creating-ftp-account-with-vsftpds.html proftpd: http://www.cyberciti.biz/tips/linux-installing-configuring-proftpd-ftp-server.html Use below commands to create FTP user in Web accessible location # useradd -c ‘FTP USER svnlabs’ -m svnlabs -d /var/www/html/svnlabs # chmod -R 775 /var/www/html/svnlabs

Upload Large Database Table to Server

Hello Friends, Sometime we want to upload large database table to server but phpMyAdmin have limit to upload SQL large *.sql files.. When we create database table “svnlabs” from mysql admin server make 3 files “svnlabs.frm”, “svnlabs.MYD” and “svnlabs.MYI” These files are located at “/var/lib/mysql/svnlabs”.. we can check this location by phpinfo.php We can upload … Read more

a2zVideo API

Welcome to the a2zVideoAPI wiki! This API supports video links to get video information like Embed Code, Video Thumb, Video Title, Video Description etc. How to use a2zVideoAPI: 1. Download “api.php” from http://github.com/svnlabs/a2zVideoAPI 2. API require PHP with CURL extension.. Setup / Upload “api.php” to your web server 3. Modify “api.php” for API Video server … Read more

PHP Debug Log – Trace Errors

Hello Friends, I read some where “Quality is not a product.. it is a process 😉 ” I think process is hard-work we do and product is final result we get. But how we make our process to get a good product, as a LAMP developer I think track processes “Debug Log” is good sort … Read more

Download youtube videos using PEAR

PEAR have rich library to access web based resources easily… <?php $sv = new SVTube(); $sv->download(“D7cm-yu-CP0”, “svnlabs.flv”) ?> Class: SVTube.php —————————— <?php require_once ‘HTTP/Client.php’; require_once ‘HTTP/Request.php’; class SVTube { var $req; var $debug = false; var $auth = false; function download ($video_id, $video_filename) { $url = “https://www.youtube.com/watch?v=”.$video_id; $this->req =& new HTTP_Request($url); $response = $this->req->sendRequest(); if … Read more

Run Shell Commands from CGI-BIN

Hey, here are some simple steps to run shell commands under cgi-bin using Apache web server (/var/www/cgi-bin), which is configured with cgi access. Apache CGI allows files with executable permission in cgi-bin directory treated as application and run on web browsers. We have to send the MIME type before outputting data to the web from … Read more

Create WebThumb using LAMP

We have to install opera/firefox  first on server. Then install Xvfb for Xvfb virtual framebuffer html2image.sh ………………………. #! /bin/sh /etc/init.d/xvfb start export DISPLAY=:7 DISPLAY=:7 opera –remote ‘openURL(‘$1′)’ & sleep 20 DISPLAY=:7  import -window root $2 /etc/init.d/xvfb stop Uses: # ./html2image.sh  https://www.svnlabs.com   webthumb/svnlabs.png Open FireFox in Xvfb: firefox.sh #!/bin/sh mozilla-firefox -a firefox -remote ‘openURL(‘$1′, new-tab)’ || … Read more

Create ZIP archives with PHP script and PEAR class

We can use PEAR to process zip files in PHP using Archive_Zip…. First set PEAR path in php include path using set_include_path Make Zipped file <?php include (‘Archive/Zip.php’);        // include PEAR ZIP package $obj = new Archive_Zip(‘test.zip’);  // zipped file name $files = array(‘svnlabs/1.gif’, ‘svnlabs/resume.doc’, ‘svnlabs/invoice.xls’);   // files add to zip if ($obj->create($files)) { echo … Read more

Stream MP3 using PHP – m3u

M3U is a computer file format that stores multimedia playlists. <?php function m3u_stream($dir) { $mp3=””; $siteurl=”http://www.domain.com/mp3/”; $h1 = opendir($dir); while ($file = readdir($h1)) { if ($file == ‘.’ || $file == ‘..’) continue; $mp3.=$siteurl.basename($dir).”/”.$file.”\r\n”; } closedir($h1); return $mp3; } $folder = “svnlabs”; file_put_contents($folder.”.m3u”, m3u_stream($_SERVER[“DOCUMENT_ROOT”].”/mp3/”.$folder.”/”)); ?> Here “svnlabs” is a folder where all mp3 files exists… … Read more

How can we use PHP to access shared library functions?

PHP function dl() – Loads a PHP extension at runtime <?php // Example loading an extension based on OS if (!extension_loaded(‘svnlabs’)) { if (strtoupper(substr(PHP_OS, 0, 3)) === ‘WIN’) { dl(‘php_svnlabs.dll’); } else { dl(‘svnlabs.so’); } } // Or, the PHP_SHLIB_SUFFIX constant is available as of PHP 4.3.0 if (!extension_loaded(‘svnlabs’)) { $prefix = (PHP_SHLIB_SUFFIX === ‘dll’) ? ‘php_’ : ”; dl($prefix . ‘svnlabs.’ . PHP_SHLIB_SUFFIX); } ?> We can use linux “nm” or “objdump” command to list symbols in object files… # nm -C … Read more