Railo - Error in Using CFSpreadsheet extension

Railo error in Using CFSpreadsheet



We have a coldfusion application running on Railo, we added the cfspreadsheet extension and when reading spreadsheets started generating an error. Like the following.

java.lang.NoClassDefFoundError, Could not initialize class org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller.



Solution:

The issue in manipulating the spreadsheet is caused by the loaded dom4j module with the Spreadsheet.cfc file. You can find it in the following path. Suppose, your website is "railo.sudosu.in" and it's document root is /home/railosudo/public_html/. You can find the Spreadsheet.cfc file in the following path.


# vim /home/railosudo/public_html/WEB-INF/railo/components/org/cfpoi/spreadsheet/Spreadsheet.cfc

Open the file in your favorite editor and around line number 20 you can find a line like the following in it. What you need to do is just comment the line.


arrayAppend(Local.paths, expandPath('{railo-web-directory}'&'/lib/dom4j-1.6.1.jar'));


When you comment this line, the 'dom4j' module will not load anymore for that website with cfspreadsheet. Once you have made the changes, you need to restart railo to make the changes in effect.

# /etc/init.d/railo_ctl restart

Try to use cfspreadsheet function in your code now...

Railo - Install Spreadsheet Extension

How to Install Spreadsheet Extension

Login to Web-Administrator of the website you want to use spreadsheet extension (cfspreadsheet). Here I am installing this extension for the website, railo.sudosu.in. In such case, the railo Web-Administrator url should like the following.

http://railo.sudosu.in/railo-context/admin/web.cfm

Follow,

Extension >> Providers



You can add the following URL in 'New Extension Provider'. Once it is added, it will show in 'Extension - Providers' section.

http://www.andyjarrett.co.uk/RailoExtensionProvider/ExtensionProvider.cfc



Then go to Applications (still under Extension), the cfspreadsheet extension now start displaying in there. 


You have to select and click 'Install' to install this extension. 




Once the installation completed, you  can see the 'cfspreadsheet' in the installed section as like in the screen shot given below.





Once you restarted railo service, you should be able to use the cfspreadsheet functions and tags for that website.


Note:

If you are getting the following error when using spreadsheet file even after installing it.


java.lang.NoClassDefFoundError, Could not initialize class org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller.

The following link will help you to fix it.

http://www.sudosu.in/2014/07/railo-error-in-using-cfspreadsheet.html

Kloxo - Upgrade PHP version to PHP 5.4.x




Kloxo, by default install PHP 5.2.x. There is no options in Kloxo to upgrade php to higher versions.


root@kloxo ~]# php -v
PHP 5.2.17 (cli) (built: Dec 18 2013 16:48:28)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

The steps given below will help you to update the php version to PHP 5.4.x.

Copy and paster the following contents into the file (/usr/local/lxlabs/kloxo/file/phpini/htaccesstemp), which is the template of php.ini for php 5.4.x .

php_value upload_max_filesize 128M
php_value max_execution_time  120
php_value max_input_time  -1
php_value memory_limit  128M
php_value post_max_size  128M
php_flag display_errors  __lx__display_error_flag
php_flag file_uploads  __lx__file_uploads_flag
php_flag log_errors  __lx__log_errors_flag
php_flag output_buffering  __lx__output_buffering_flag
php_flag register_argc_argv  __lx__register_argc_argv_flag
php_flag mysql.allow_persistent  __lx__mysql_allow_persistent_flag
php_flag register_long_arrays  __lx__register_long_arrays_flag
php_flag allow_url_fopen  __lx__allow_url_fopen_flag
php_flag cgi.force_redirect  __lx__cgi_force_redirect_flag
php_flag enable_dl  __lx__enable_dl_flag

Inorder to protect the file from Kloxo updates,
[root@kloxo ~]# chattr +i /usr/local/lxlabs/kloxo/file/phpini/htaccesstemp

Copy and paster the following contents into the file (/usr/local/lxlabs/kloxo/file/phpini/php.ini.temp), which is the template of php.ini for php 5.4.x .

[PHP]
engine = On
asp_tags = Off
precision = 14
output_buffering = __lx__output_buffering_flag
zlib.output_compression = __lx__output_compression_flag
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions = shell_exec
disable_classes =
zend.enable_gc = On
expose_php = Off
max_execution_time = 180
max_input_time = -1
memory_limit = 128M
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
display_errors = __lx__display_error_flag
display_startup_errors = Off
log_errors = __lx__log_errors_flag
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = __lx__register_argc_argv_flag
auto_globals_jit = On
post_max_size = 128M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = __lx__enable_dl_flag
file_uploads = __lx__file_uploads_flag
upload_max_filesize = 128M
max_file_uploads = 20
allow_url_fopen = __lx__allow_url_fopen_flag
allow_url_include = __lx__allow_url_include_flag
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = __lx__mysql_allow_persistent_flag
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.save_path = __lx__session_save_path_flag
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[Assertion]
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]

date.timezone = "Europe/Warsaw"

zend_extension=/usr/lib/kloxophp/ioncube/ioncube_loader_lin_5.4.so
zend_extension=/usr/lib/php/modules/opcache.so
extension=/usr/lib/php/modules/apc.so

opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.save_comments=0
opcache.enable_file_override=1



Inorder to protect the file from Kloxo updates,

[root@kloxo ~]# chattr +i /usr/local/lxlabs/kloxo/file/phpini/php.ini.temp

 Download IonCube loaders for PHP 5.4 and unpack them into: /usr/lib/kloxophp/ioncube

[root@kloxo kloxophp]# cd /usr/lib/kloxophp

If your architecture is 64 bit,

[root@kloxo kloxophp]# wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz


If your architecture is 32 bit,

[root@kloxo kloxophp]# wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz

[root@kloxo kloxophp]# tar -xzvf ioncube_loaders_lin_*.tar.gz



Download and Install Zend Optimizer

[root@kloxo ~]# curl -LOk https://github.com/zendtech/ZendOptimizerPlus/archive/master.zip
[root@kloxo ~]# unzip master.zip
[root@kloxo ~]# cd ZendOptimizerPlus-master
[root@kloxo ZendOptimizerPlus-master]# /usr/bin/phpize
[root@kloxo ZendOptimizerPlus-master]#  ./configure  --with-php-config=/usr/bin/php-config
[root@kloxo ZendOptimizerPlus-master]# make && make install



Download and Install Remi repository for PHP 5.4

[root@kloxo ~]# wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
[root@kloxo ~]# wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
[root@kloxo ~]# rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm


Update the PHP version using remi repository,

[root@kloxo ~]# yum update php --enablerepo=remi


Install APC cache,

[root@kloxo ~]# pecl install apc


To update the php.ini file as we configured earlier.

[root@kloxo ~]# /script/fixphp


Depending upon the webservice you are running, restart apache or lighttpd.

[root@kloxo ~]# /etc/init.d/httpd restart
or
[root@kloxo ~]# /etc/init.d/lighttpd restart



Ensure Ioncube is loaded in php.ini,

[root@kloxo ~]# grep ioncube_loader /etc/php.ini
zend_extension=/usr/lib/kloxophp/ioncube/ioncube_loader_lin_5.4.so


Ensure opcache is loaded in php.ini,

[root@kloxo ~]# grep opcache.so /etc/php.ini
zend_extension=/usr/lib/php/modules/opcache.so


Ensure APC is loaded in php.ini,

[root@kloxo ~]# grep apc.so /etc/php.ini
extension=/usr/lib/php/modules/apc.so


Once everything discussed above is setup, you will get the following result..

[root@kloxo ~]# php -v
PHP 5.4.25 (cli) (built: Feb 11 2014 09:00:15)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

That's it..!!

Kloxo - pure-ftpd: relocation error: pure-ftpd: symbol my_make_scrambled_password, version libmysqlclient_15 not defined in file libmysqlclient.so.15 with link time reference



Kloxo, by default install  MySQL 5.0.92  and PHP 5.2.x version when we setup the server. Since the Kloxo developement is stopped, there is no direct way to update php and mysql versions Anyway I have upgraded one of my Kloxo (LXAdmin) server to  MySQL 5.5.36 and PHP 5.4.25 by following the given article.


http://linuxadmintips4u.blogspot.com/2014/02/kloxo-upgrade-php-version-to-php-54x.html

All of my websites are working fine in the server and I noted that the FTP port is listening but can't use the FTP server. I was getting the following error each time when I tried connecting to the FTP server.

[root@kloxo ~]# ftp localhost
Connected to localhost.
pure-ftpd: relocation error: pure-ftpd: symbol my_make_scrambled_password, version libmysqlclient_15 not defined in file libmysqlclient.so.15 with link time reference
ftp> 

Usually these all errors can be fixed by just upgrading/downgrading the pure-ftpd or by installng/updating mysql server.  But here in this case, it is using lxcentre's rpm package and it's development is stopped.

[root@kloxo ~]# rpm -qa | grep pure-ftpd
pure-ftpd-1.0.35-0.lxcenter.0

There is no rpm packages to install and solve this problem. But it can be fixed by just downloading the following pure-ftpd binary file and replace it with the existing Kloxo pure-ftpd binary.

[root@kloxo src]#  cd /usr/local/src
[root@kloxo src]# wget -O pure-ftpd.tgz https://sites.google.com/site/sudosuin/pure-ftpd.tgz
[root@kloxo src]# tar -xzf pure-ftpd.tgz
[root@kloxo src]# cp -f /usr/local/src/pure-ftpd /usr/sbin/pure-ftpd

Now try to connect to FTP again,

[root@kloxo ~]# ftp localhost
Connected to localhost.
421 Sorry, but that file doesn't exist: [/etc/ssl/private/pure-ftpd.pem]
ftp>


Since the binary is compiled to work with TLS/SSL so you must copy the file to the ssl certificate:

[root@kloxo ~]# cp /etc/pki/pure-ftpd/pure-ftpd.pem /etc/ssl/private/pure-ftpd.pem

At this time, everything will be working fine.. Test it yourself..!! :)

[root@kloxo ~]# ftp localhost
Connected to localhost.
220-Welcome to Pure-FTPd.
220-You are user number 1 of 5000 allowed.
220-Local time is now 00:32. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
500 This security scheme is not implemented
500 This security scheme is not implemented
KERBEROS_V4 rejected as an authentication type
Name (localhost:root):

That's it..!!!

Install Wildcard SSL Certificates - cPanel

       Install Wildcard SSL Certificates - cPanel



Before installing this certificate, you should make sure the wildcard subdomain (*.domain.com) has been created in the control panel as well. This is required for proper functioning and installation of the SSL certificate.


Normally customers want their SSL configuration to look something like this:

https://mydomain.com => /home/user/public_html
https://order.mydomain.com => /home/user/public_html/order
https://billing.mydomain.com => /home/user/public_html/billing

We can setup only one SSL virtual host per IP address. However, we can mimic this behavior by using mod_rewrite rules. Here are the steps:

1) Install the wildcard SSL certificate as you normally do so the DocumentRoot is /home/user/public_html/ and the ServerName is *.domain.com.

2) Setup the following mod_rewrite rules in their .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/sub.domain.folder/
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^sub.domain.com
RewriteRule ^(.*)$ /sub.domain.folder/$1 [NC,L,NS]

* NC is nocase of course, unnecessary with a .* match but is inserted for paranoia sake.
* L is ‘last’ which stops rewriterule processing on match
* NS is ‘no subrequest’ which keeps internal URI’s from being reprocessed. This may help or break things and would require testing. Look for flash applets or javascripts that don’t load.

** If you are seeing 404 not found errors after adding these rules, check the errors and the path that the connection is trying to take. If you are seeing that the connections are forcing to an addon directory and not redirecting to the subdomain directory, you may need to add a symlink in the addon directory pointing to the subdomain directory due to the redirects not being able to escape doc root.For Example:

[Tue Dec 18 10:29:07 2013] [error] [client xx.xx.xx.xx] File does not exist: /home/sudosu/public_html/subdomain.com/somefile

ln -s /home/northlic/public_html/sub.subdomain.com/ /home/northlic/public_html/subdomain.com/

3) Clear all of your browser cache and try accessing the subdomains.

That's it..:)

Fix "Leverage browser caching" and "Add Expires headers" for your website

Fix "Leverage browser caching" and "Add Expires headers" for your website




We can reduce the number of HTTP requests that the server needs to process by leveraging browser caching. This will reduce the time taken for loading the site and hence website performance can be increased. We can achieve this by adding  Expires headers to our .htaccess This will also help you improve the performance of your website, based on Google’s and Yahoo’s recommended performance guidelines.

Browser caching can help by storing some of these files locally in the user's browser. Their first visit to your site will take the same time to load, however when that user revisits your website, refreshes the page, or even moves to a different page of your site, they already have some of the files they need locally. This means the amount of data the user's browser has to download is less, and fewer requests need to be made to your server. It will decrease the page load times.

This artcle is written based on the assumption that You are using Apache webserver with the module mod_expires enabled and you have permission to edit the .htaccess file of youe website.


Leverage browser caching and Add Expires headers

We can achieve browser caching by adding Expires headers in the htaccess file. If your site has returning visitors, this will reduce the number of HTTP requests by caching the contents of your site like, images: jpg, gif, png ,favicon/ico, javascript and css.

When someone visits your site, their browser will fetch all your images, css files, javascript files, etc. If "Leverage browser caching" is not enabled, if the same vistor viewing your site again and again these contents were fetching repeatedly. Expires headers you tell your website visitor’s browser that the file types you specified via htaccess are not changing until after a certain time, for example a month. By doing this, the browser do not want to download the images, css and javascript files repeatedly. The browser can cache the contetns until their expiry date, so repeated vistis do not take much time and will not make as many HTTP requests that took in the first time visit.

If cached, the document may be fetched from the cache rather than from the source until this time has passed. After that, the cache copy is considered “expired” and invalid, and a new copy must be obtained from the source.


Website performance Testing Tools

You can check your site's performance by using the following online tools.

https://developers.google.com/speed/pagespeed/insights
http://developer.yahoo.com/yslow/
http://gtmetrix.com/


Generate htaccess for "Leverage browser caching"

In oder to generate the htaccess entries for fixing the Leverage browser caching, it is needed to identify what all types of files are containing in your site. You can find these types from the "Leverage browser caching" section in the performace testing result of your website discussed in the above section.
Let you have the following type of files,

images: jpg, gif, png
favicon/ico
javascript
css


You need to also determine how often, you are changing the files in your site(These are the expiry of those contents), the following expiry options are available in this case.

years
months
weeks
days
hours
minutes
seconds




Expires header for your favicon

The files like favicon are the rarely changing, so you can give a long time for favicon. Here we can use the following entry for the favicon, it is specified that the favicon file expires only after 1 year. The following entry instruct your browser to cache the contetns for 1 year from the day of the first visit. If your website visitor clears the browser cache, it will re-fetch the resources again.

ExpiresByType image/x-icon "access plus 1 year”


Expires header for the images

If you are updating the images in your sites are frequently, like every week you can set the entry as follows. The following entry instruct your browser to cache the contetns for 1 week from the day of the first visit. If your website visitor clears the browser cache, it will re-fetch the resources again. If is changing every week, you can change it accordingly.

ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"


Expires header for your css

The following entry instruct your browser to cache the CSS contetns for 1 month from the day of the first visit. If your website visitor clears the browser cache, it will re-fetch the resources again. If is changing every week, you can change it accordingly.

ExpiresByType text/css "access plus 1 month”


Expires header for your javascript

The following entry instruct your browser to cache javascript contetns for 1 year from the day of the first visit. If your website visitor clears the browser cache, it will re-fetch the resources again. If is changing every week, you can change it accordingly.


ExpiresByType application/javascript "access plus 1 year"



You can combine all of the settings in single. In the following htaccess file, there is different kind of files with different expiry settings. Change the following htaccess file depending upon the contents in your website.

#######################################################
<IfModule mod_expires.c>
ExpiresActive on

ExpiresByType text/css "access plus 14 days"
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType text/javascript "access plus 14 days"
ExpiresByType text/html "access plus 14 days"

ExpiresByType image/x-icon "access plus 1 year”
ExpiresByType image/ico "access plus 14 days"
ExpiresByType image/jpg "access plus 14 days"
ExpiresByType image/jpeg "access plus 14 days"
ExpiresByType image/gif "access plus 14 days"
ExpiresByType image/png "access plus 14 days"
ExpiresByType image/svg+xml "access plus 1 month"

ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/mp4  "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"


ExpiresByType application/pdf "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 14 days"
ExpiresByType application/x-font-woff  "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/xml  "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/rss+xml   "access plus 1 hour"
ExpiresByType application/atom+xml  "access plus 1 hour"
</IfModule>
#######################################################


Once you add these contents in the htaccess file, you can test the performance of your site again in the tools discussed above. You can find that the recommended fixing "Leverage browser caching" is passed.

That's it..........!!!


Reference:

http://httpd.apache.org/docs/2.2/mod/mod_expires.html

Redirect a Main Domain in cPanel to it's Parked Domain

      Redirect a Main Domain in cPanel to it's Parked Domain




I have a main domain, 'redirect-from.com' with user name 'redirect' in my cpanel and I have craeted a parked domain 'redirect-to.com' in this account. As you know both are loading the same pages here.

I need to redirect the url, http://redirect-to.com/ to http://redirect-to.com/ , for that I have select the option, 'Redirect' from the cPanel and I have encountered an error like the following when adding the redirect. I have this problem only when creating a redirect via cPanel when creating redirect rule from the main domain to a parked domain in the same account.


Error Adding Redirection

Redirecting "" to "http://redirect-to.com/" will cause a redirection loop because "http://redirect-from.com/", which is located at "/home/redirect/public_html/", is above "http://redirect-to.com/", which is located at "/home/redirect/public_html/" .



I have created a rule in my htaccess as follows to redirect the main domain to it's parked domain.


# cat /home/redirect/public_html/.htaccess

###########################

RewriteEngine On

RewriteCond %{HTTP_HOST} ^redirect-from.com$ [NC]
RewriteRule ^(.*) http://redirect-to.com/$1 [R=301,L]

##########################

Install uploadprogress in Ubuntu/Debian Server

                            Install uploadprogress in Ubuntu/Debian Server



Install the PHP developer package for the version of PHP you're using. For example, in case of php5 run:
$ sudo apt-get install php5-dev

Install the PECL uploadprogress library:
$ sudo pecl install uploadprogress

$ cd /etc/php5/apache2/conf.d
$sudo echo "extension=uploadprogress.so" > uploadprogress.ini

Restart apache:
$ sudo /etc/init.d/apache2 restart

Once you have done the above steps, you can find 'uploadprogress' in the phpinfo page.

That's it...

Install MP4Box (GPAC) in Ubuntu/Debian

                                   Install MP4Box(GPAC) in Ubuntu/Debian



MP4Box is a MP4 multiplexer utility, which can import MPEG-4 video, DivX, XviD, 3ivx, h264 etc, audio streams and subtitles into the .mp4 container. The end result is a compliant MP4 stream. It can also extract streams from a .mp4. MP4Box is a command line tool, but can be used with graphical user interfaces such as YAMB or my MP4box GUI.


First of all you need to install subversion to available 'svn' command.


# apt-get install subversion

Download the latest 'gpac' from svn repository.
# svn co https://svn.code.sf.net/p/gpac/code/trunk/gpac gpac

Configure the source package.
# cd gpac
# chmod +x configure
# ./configure --disable-opengl --use-js=no --use-ft=no --use-jpeg=no --use-png=no --use-faad=no --use-mad=no --use-xvid=no --use-ffmpeg=no --use-ogg=no --use-vorbis=no --use-theora=no --use-openjpeg=no

Install the gpack package.
# make
# make install
# cp bin/gcc/libgpac.so /usr/lib


Verify the installation

# which MP4Box
/usr/local/bin/MP4Box

# /usr/local/bin/MP4Box
MP4Box [option] input [option]
-h general:          general options help
-h hint:             hinting options help
-h import:           import options help
-h encode:           encode options help
-h meta:             meta handling options help
-h extract:          extraction options help
-h dump:             dump options help
-h swf:              Flash (SWF) options help
-h crypt:            ISMA E&A options help
-h format:           supported formats help
-nodes:              lists supported MPEG4 nodes
-node NodeName:      gets MPEG4 node syntax and QP info
-xnodes:             lists supported X3D nodes
-xnode NodeName:     gets X3D node syntax
-snodes:             lists supported SVG nodes
-snode NodeName:     gets SVG node syntax
-languages:              lists supported ISO 639 languages
-quiet:               quiet mode
-v:                  verbose mode
-version:            gets build version



That's it..

Magento Optimized htaccess

                                  Magento Optimized htaccess


The following htaccess entries are the optimized htaccess for a Magento, it will speedup your site upto 20%.
I have tested this htaccess in few sites and i have found that the speed of the site increased by 20%. You can also view the performance of your site after adding this site using the following link.

https://developers.google.com/speed/pagespeed/insights/

Feel the difference and optimize your site easily just by adding this, If you are getting more than 80% for your site in the above page speed test, it a good result.


########################################################################

## enable apache served files compression (not php, html/images/css/js

## http://developer.yahoo.com/performance/rules.html#gzip

<IfModule mod_deflate.c>

          # Insert filter on all content

          SetOutputFilter DEFLATE

          # Insert filter on selected content types only

          AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

          # Netscape 4.x has some problems...

          BrowserMatch ^Mozilla/4 gzip-only-text/html

          # Netscape 4.06-4.08 have some more problems

          BrowserMatch ^Mozilla/4\.0[678] no-gzip

          # MSIE masquerades as Netscape, but it is fine

          BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

          # Don't compress images

          SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

          # Make sure proxies don't deliver the wrong content

          Header append Vary User-Agent env=!dont-vary

</IfModule>

###################################################################

## Enable keep-alives to reduce # http requests

<ifModule mod_headers.c>

            Header set Connection keep-alive

</ifModule>

###################################################################

## Add default Expires header

## http://developer.yahoo.com/performance/rules.html#expires

<IfModule mod_expires.c>

# Turn on Expires and set default to 0

            ExpiresActive On

            ExpiresDefault A0

            # Set up caching on media files for 1 year (forever?)

            ExpiresDefault A29030400

            Header append Cache-Control "public"

            # Set up caching on media files for 2 weeks

            ExpiresDefault A1209600

            Header append Cache-Control "public"

            # Set up 1 week caching on commonly updated files

            ExpiresDefault A604800

            Header append Cache-Control "proxy-revalidate"

            # Force no caching for dynamic files

            ExpiresActive Off

            Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"

            Header set Pragma "no-cache"

</IfModule>

Header unset Pragma
Header unset ETag
FileETag None

##############################################################################


Hope this helped....