Category: Ubuntu

APC extension Enable in apache

To enable APC extension on Ubuntu, Use the following command sudo apt-get install php-apc To enalbe APC extension on Windows, 1) Go to http://downloads.php.net/pierre/ 2) Download php_apc-.zip 3) Copy php_apc.dll to /ext folder 4) In your php.ini, make sure you have: extension=php_apc.dll 5) Restart your server.

Permanent link to this article: https://blog.openshell.in/2012/04/apc-extension-enable-in-apache/

How To Install memcached with memcache PHP Extension on Ubuntu

memcached and the PHP5 memcache module are available as packages, so we can install them as follows: sudo apt-get install memcached php5-memcache

Permanent link to this article: https://blog.openshell.in/2012/04/how-to-install-memcached-with-memcache-php-extension-on-ubuntu/

Enable Sqlite in PHP on Apache

To enable SQLite on Windows/Apache/PHP setup, Uncomment the following lines in the php.ini file and restart Apache: [code] extension=php_pdo.dll extension=php_pdo_sqlite.dll [/code] To enable SQLite on Ubuntu, Use the following command [code] sudo apt-get install sqlite php5-sqlite sudo apt-get install php-pear php-apc php5-curl [/code]

Permanent link to this article: https://blog.openshell.in/2012/04/enable-sqlite-in-php-on-apache/

session-start – headers already sent

This happens when you try to start session more than once. [php] The solution for above problem is 1) in php.ini file set session.autostart to 0 session.auto_start = 0 2) Placing a .htaccess file in the root of your web directory with the following value: php_flag session.auto_start 0 3) In your code use this line …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/10/1263/

PHP characters limitation

Characters limitation will helps to display limited number of characters to display. [php] function limit_characters( $str, $n ) { if ( strlen ( $str ) <= $n ) { return $str; } else { return substr ( $str, 0, $n ) . ‘…’; } } [/php]

Permanent link to this article: https://blog.openshell.in/2011/09/php-characters-limitation/

Resize image in specified height & width while upload

Resizing images in specified height & width while uploading files to the server. [php] /* Create a thumbnail of $srcFile and save it to $destFile. The thumbnail will be $width pixels. */ function createThumbnail($srcFile, $destFile, $new_w, $new_h, $quality = 75) { $thumbnail = ”; if (file_exists($srcFile) && isset($destFile)) { $size = getimagesize($srcFile); $old_x = $size[0]; …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/09/resize-image-in-specified-height-width-while-upload/

PHP Automatic Session Logout

Automatic logout script if users have inactive more than 15 minutes [php] <?php session_start(); $inactive = 900; // Set timeout period in seconds if (isset($_SESSION[‘timeout’])) { $session_life = time() – $_SESSION[‘timeout’]; if ($session_life > $inactive) { session_destroy(); header("Location: logoutpage.php"); } } $_SESSION[‘timeout’] = time(); ?> [/php]

Permanent link to this article: https://blog.openshell.in/2011/09/php-automatic-session-logout/

PHP MYSQL ORDER BY Multiple Columns

If you want to Order 2 or more columns in SQL Query. When ordering by more than one column, the second column is only used if the values are identical with the onces in the first column. Example [sql] ‘Order by Column ORDER BY COLUMN1, COLUMN2 [/sql] Order 2 or more columns with different orders …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/09/php-mysql-order-by-multiple-columns/

Setting up dual ip address in ubuntu

Hi, here is a simple way to setup dual ip in your ubuntu system if you already have eth0 as 192.168.0.10 then if you want 192.168.1.10 then use the following command to bring up a alias but this is temporary sudo ifconfig eth0:0 192.168.1.11 up To have a permanent dual ip update the /etc/network/interfaces file like the below …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/08/setting-up-dual-ip-address-in-ubuntu/

Using Dialup modems in ubuntu

hi all, Everyone will be familiar with configuring wired and wireless network in Ubuntu. But still at some point of time we may have the need to use dialup modem in ubuntu. here is a simple way to configure dialup modems in ubuntu. The following command will install gnome-ppp which is a gui based configuration tool for …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/08/using-dialup-modems-in-ubuntu/