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

Class Loading in J2SE Environment

Java Class Loading mechanism is one of the darkest corners inside java virtual machine. The class loading concept describes the behavior of converting a named class into the bits responsible for implementing that class. Wait a minute! “I never have to deal with it. Why do I need to know this bulky philosophy”, this might … 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

MySQL Related Search (title+tags+description)

What you think? What will be the best option to search related videos in mysql videos table with matching title+tags+description? Very easy Idea! # SELECT * FROM `videos` WHERE title LIKE ‘%$title%’ OR tags LIKE ‘%$tags%’ OR description LIKE ‘%$description’; Full-text Search is a feature introduced to MySQL in version 3.23.23. You have to add … Read more

Install libpurple with PHP

libpurple is intended to be the core of an IM program. This libpurple PHP binding, which defines a set of internal classes, gives a possibility to use aol and icq (oscar), yahoo, msn, jabber, irc and much more protocols directly from PHP. Write your own IM chat client in PHP, as simply as PHP enables … Read more

Session lost when switching from HTTP to HTTPS in PHP

Sometime we face the problem when we navigate from HTTP URL to HTTPS URL our session lost. You can manage session between HTTP to HTTPS or HTTPS to HTTP: 1. Transmit session ID between page using GET 2. POST session ID by POST 3. Use files to save sessions 4. Use Cookies for sessions 5. … Read more

VideoAPI

Curl must be on your server to use this plugin. This widget tested to latest version of wordpress. Download a2zVideoAPI.zip Extract and upload a2zVideoAPI.php to the plugins/ directory Enable a2zVideoAPI Widget in the Plugin admin panel Place a2zVideoAPI in the sidebar, and edit it to enter the Video URL