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

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

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

FFmpeg

# ffmpeg is a command line tool to convert one video file format to another. It can also grab and encode in real time from a TV card. # ffserver is an HTTP and RTSP multimedia streaming server for live broadcasts. It can also time shift live broadcast. # ffplay is a simple media player … Read more

7 Simple Steps to create Twitter Application

First you have to download oAuth from github “An open protocol to allow secure API authorization in a simple and standard method from desktop and web applications.” 7 Simple Steps to create Twitter Application using Twitter’s OAuth…. 1. Build TwitterOAuth object Login to twitter and register a new application here https://twitter.com/oauth_clients … after registering application … Read more

Magic of PEAR – Date TimeZone

PEAR is a framework and distribution system for reusable PHP components. How we get PEAR packages with php files? Add block of code to the php file…. <?php // include PEAR class include (“Date.php”); // initialize Date object $d = new Date(“1981-08-07 01:30:11”); // retrieve date to display echo $d->getDate(); // retrieve date as formatted … Read more

Install the Alternative PHP Cache (APC)

The Alternative PHP Cache (APC) is a free, open, and robust framework for caching and optimizing PHP intermediate code. yum install php-pear yum install php-devel httpd-devel yum groupinstall ‘Development Tools’ yum groupinstall ‘Development Libraries’ pecl install apc http://si2.php.net/manual/en/install.pecl.php

Install PECL Memcache with LAMPP

PECL Memcache client of memcached distributed cache server, is a very probable candidate for high-load systems. Typically you won’t be able to use “pecl” directly and when you try to install manually with phpize you will get an error like: ” PHP Warning: Unknown(): Unable to load dynamic library ‘/opt/lampp/lib/php/extensions/no-debug-non-zts-20020429/memcache.so’ – /opt/lampp/lib/php/extensions/no-debug-non-zts-20020429/memcache.so: undefined symbol: OnUpdateLong … Read more