Latest Compile with pdo drivers for mysql along with mod_security.
NOTE:
Remove the MySQL-shared rpm else openssl will not work.
# rpm -e MySQL-shared-5.0.20a-0.glibc23
PHPPHP scripts and tricks... Static compile and install of apache + mod_ssl + php on FC4Submitted by sandip on Tue, 05/22/2007 - 15:24Latest Compile with pdo drivers for mysql along with mod_security. NOTE: # rpm -e MySQL-shared-5.0.20a-0.glibc23 Load your PHP pages faster with GZip compressionSubmitted by sandip on Sat, 12/23/2006 - 00:57If you have heavy pages with lots of images and text, you can greatly improve its' performance by dynamically compressing the page with php. Put the below code in the header of each php page. <? ob_start("ob_gzhandler"); ?> It automatically gzips the page for browsers that support it. This could also be set in the php.ini file instead, so all php pages are automatically compressed without having to add the above code in each and every php page. In php.ini add the below code: output_handler = ob_gzhandler »
How to fix _Can't open file: 'sessions.MYI'_ in DrupalSubmitted by sandip on Fri, 03/10/2006 - 23:57This seems to occur if mysql crashes for some reason and corrupts the sessions table for Drupal. mysql> REPAIR TABLE sessions QUICK; You can also use phpmyadmin to repair the table. Related Reading: MySQL Database Repair »
Compiling support for XSLT in PHPSubmitted by sandip on Fri, 02/24/2006 - 22:49XSLT, Extensible Stylesheet Language (XSL) Transformations is a language for transforming XML documents into other XML documents. It is a standard defined by The World Wide Web Consortium (W3C). Information about XSLT and related technologies can be found at http://www.w3.org/TR/xslt. PHP XSLT extension only supports the Sablotron library from the Ginger Alliance. The extension does not come standard with Redhat Enterprise... and the compilation was a bit tricky. So if you are having difficulty, theses notes may help you some... Listing image files in folders and subfolders with PHPSubmitted by sandip on Wed, 01/11/2006 - 11:09Here's a quick way to create a listing of images uploaded to a folder with php: <?php // file name: list_pics.php global $startDir; /** * List Directories function, which transverses sub-folders * listing out the image files that exists within it. */ function listDir( $path ) { global $startDir; $handle = opendir( $path ); while (false !== ($file = readdir($handle))) { if( substr( $file, 0, 1 ) != '.' ) { if( is_dir( $path.'/'.$file ) ) { listDir( $path.'/'.$file ); } else { if( @getimagesize( $path.'/'.$file ) ) { /* // Uncomment if using with the below "pic.php" script to // encode the filename and protect from direct linking. $url = 'http://domain.tld/images/pic.php?pic=' .urlencode( str_rot13( substr( $path, strlen( $startDir )+1 ).'/'.$file ) ); */ $url='http://domain.tld/images/'. substr( $path, strlen( $startDir )+1 ).'/'.$file; // You can customize the output to use img tag instead. echo "<a href='".$url."'>".$url."</a><br>"; } } } } closedir( $handle ); } // End listDir function $startDir = '.'; listDir( $startDir ); ?> »
Generate a dynamic playlist of mp3 files in a folder with PHPSubmitted by sandip on Thu, 12/22/2005 - 23:42Below is a simple php script to generate a playlist of the mp3 files placed in a folder. I have tested it to work with XMMS media player on FC4 and should work with others too. Substitute the path and the url of the music folder. <?php // music_playlist.php $folder_path = './music_folder'; $folder_url = 'http://domain.tld/music_folder/'; if ($handle = opendir($folder_path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $song_list .= $folder_url.$file."\n"; } } closedir($handle); } else { echo "Music folder does not exist!"; exit; } // send header of audio/x-mpegurl content type header('Content-type: audio/x-mpegurl'); if (preg_match("/MSIE 5.5/", $HTTP_USER_AGENT)) { header("Content-Disposition: filename=\"my_playlist.m3u\""); } else { header("Content-Disposition: inline; filename=\"my_playlist.m3u\""); } echo "$song_list"; ?> Related Reading: Listen to mp3 songs using XMMS in Redhat/Fedora »
Sending form data to email via phpSubmitted by sandip on Sat, 05/21/2005 - 21:09The below is a simple script that handles sending form data to email using php: <?php // checks to see if the page that called this script was sent from the same host if ($_SERVER['REQUEST_METHOD']=="POST"){ if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 || !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) die("Bad referer"); // begin building the message body $msg="Values submitted by the user:\n"; foreach($_POST as $key => $val){ if (is_array($val)){ $msg.="Item: $key\n"; foreach($val as $v){ »
PHP AcceleratorSubmitted by sandip on Fri, 01/28/2005 - 21:43PHP Accelerator is an easily installed PHP Zend engine extension that provides a PHP cache, and is capable of delivering a substantial acceleration of PHP scripts without requiring any script changes, loss of dynamic content, or other application compromises.
Unpackage it and move contents to "/usr/local/phpaccelerator". Include the below line to php.ini under dynamic extension section: zend_extension="/usr/local/phpaccelerator/php_accelerator_1.3.3r2.so" »
Get PHPwiki up and running with mysqlSubmitted by sandip on Thu, 12/16/2004 - 16:02Ran into some difficulty installing the wiki with mysql backend as the documentation wasn't upto-date. Below are some notes and customization done during the process:
»
Top 10 ways to crash PHPSubmitted by himanshu on Sun, 08/15/2004 - 07:02Programming errors are of many kinds but the consequences can range from harmless to downright dangerous. »
|
User loginRecent blog posts
Who's onlineThere are currently 0 users and 2 guests online.
|