Friday 27 June 2014

Windows 7 Panning Desktop Applications

http://superuser.com/questions/85362/looking-for-an-application-that-scrolls-or-pans-netbook-screens-running-windows

http://ynea.futureware.at/cgi-bin/infinite_screen.pl


http://kjh.ca/contour_mods/doku.php?id=solution_for_storyteller_on_1024x600%3asolution_for_storyteller_on_1024x600


http://www.addictivetips.com/windows-tips/get-infinite-scroll-on-windows-desktop-with-windowslider/

http://ficusdev.com/WindowSlider/Description

Friday 20 June 2014

Page caching for Buddypress? Transients, memcached, vs others

Since Buddypress works on having users login, page caches software such W3 Total Cache, BP Super Cache, Nginx microcache, APC, Memcached, etc. won't work.

What would work is a partial page caching software. But there doesn't seem to be any such software now.

http://chrislema.com/high-performance-wordpress-membership-site/

However, by using the wordpress transients API, one can manually code fragment or partial page caching.

http://premium.wpmudev.org/blog/wordpress-transients/

Problems with transients:

http://wpengine.com/2013/02/21/wordpress-transient-api/

Starting with Wordpress 3.7, transients are garbage collected, so the issues mentioned above may be fixed.

Enabling Opcache in PHP

Here are the commands that can be entered in php.ini for configuration of the opcache. There is also an explanation ofthe features.

http://www.php.net//manual/en/opcache.configuration.php


Here are some Opcache GUI reporting tools:

https://rtcamp.com/tutorials/php/zend-opcache/

Some configuration tips:

https://www.activecollab.com/blog/3-zend-opcache-memcached.html

More detailed configuration tips:

https://www.scalingphpbook.com/best-zend-opcache-settings-tuning-config/



Tuesday 17 June 2014

Wordpress: Disable heartbeat

If wordpress is taking too much server resources, you can disable wordpress heartbeat. If you are using buddypress, disable "Activity auto-refresh" in Buddypress settings.

http://www.inmotionhosting.com/support/website/wordpress/heartbeat-heavy-admin-ajax-php-usage

In the above page, you will find the code to disable heartbeat on all pages except post.php and post-new.php (here it is required for autosave while creating new posts and commenting).

To be added in functions.php

add_action( 'init', 'stop_heartbeat', 1 );

function stop_heartbeat() {
        global $pagenow;

        if ( $pagenow != 'post.php' && $pagenow != 'post-new.php' )
        wp_deregister_script('heartbeat');
}

Nginx with CPanel

http://cpxstack.sysally.net/

Cpxstack is a plugin to cPanel that completely replaces Apache with nginx (other plugins keeps apache and configure nginx as a reverse proxy).

To install cpxstack, you need Incron. For this you need to enable the EPEL repository (see previous article for this).

You also need to install php-devel. Cpanel prevents installing any php related packages through an "exclude" entry in yum.conf. Open yum.conf and remove "php*".

After upgrading to the latest stable PHP version, you should enable the Remi repository and the php55 remi repository. You can now install php-devel.

You can run the cpxstack.sh script as per instructions here: http://cpxstack.sysally.net/documentation.htm

For incron and php-devel you can alternatively directly run the cpxstack.sh script to see if it installs these packages automatically.

After the script has run, you should go to WHM, when you click on the cpxstack icon in the sidebar, it will ask you to change a setting in the Tweak Settings area.
You also need to go to cPanel and manually enable nginx for your site. Also in WHM change the default number of worker processes to a lower number (default is 15).

http://www.nginxtips.com/cpxstack-nginx-php-fpm-cpanel/

Nginx: Allow selected IP addresses only

  server {
    listen 80;
    server_name www.foo.bar;

    location / {

      allow   my.public.ip.here;
      deny    all;
    }
  } 
 
You can have multiple "allow" lines.

http://stackoverflow.com/questions/8438867/how-can-i-allow-access-to-a-single-ip-address-via-nginx-conf

301 permanently moved redirect with PHP

The following php commands will do a 301 redirect when using PHP FPM 
 
 
header('Status: 301 Moved Permanently', true);
header('Location: ' . $url); // or header('Location: ' . $url, true, 301);
 
http://stackoverflow.com/questions/5268454/php-301-redirect-impossible 

Nginx configuration for Wordpress

For wordpress pretty permalinks to work, you need to add this to your nginx.conf file where the wordpress directory is /wordpress:

location /wordpress {
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
}

Nginx configuration for Moodle

If the moodle directory is /moodle then put this in the configuration file nginx.conf or the appropriate file under the nginx.include.d folder:

server {
     server_name  example.com www.example.com;
     rewrite ^/moodle/(.*\.php)(/)(.*)$ /moodle/$1?file=/$3 last;
 
In the same file, in the php section:
 
  location ~ \.php$ {
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
 
 
Putting the same rewrite rule in the location /moodle section does not work.
 
If you are using the cpXstack plugin for cPanel, make sure you follow this:
 
For any domain that has nginX+PHP-FPM enabled, additional nginX configuration can be added by the root user at
/opt/pifpm/nginx.include.d/<DOMAINNAME>.autoinclude where DOMAINNAME is the domain .
 
Changes made any where else may not be preserved during server shut down. 

Monday 16 June 2014

cPanel: Install php-devel

CPanel disables installation of php related packages using yum. To enable it:

nano /etc/yum.conf

Remove php* from the "exclude" line.

EPEL repositories for Fedora and Cent OS

Certain applications such as incron can't be found in the default repositories of Cent OS. To get this software, you need to enable the EPEL (Extra Packages for Enterprise Linux) repository:

https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F

http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x