CentOS time is incorrect by few seconds or minutes

If your centos server’s time is off by just few seconds, or 1 and half minute like mine, you are probably missing NTP deamon which would synchronize time with remote server.
Login as root ( or prepend sudo in front of following commands

yum install ntp ntpdate ntp-doc
chkconfig ntpd on
ntpdate pool.ntp.org
systemctl enable ntpd
systemctl start ntpd

And that’s it, you should see a message telling you how much off your time was. And if you do a date command now, it should show the exact same date as your computer.

root@server: ~# ntpdate pool.ntp.org
17 Oct 10:06:43 ntpdate[5211]: step time server 37.59.27.22 offset -32.044835 sec

[Laravel 5] Call to undefined method Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandler()

If you are getting following error:

PHP Notice:  date_default_timezone_set(): Timezone ID '' is invalid in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 45

[2017-10-16 19:50:38] production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandler() 
                                                                                                 
  [Symfony\Component\Debug\Exception\FatalThrowableError]                                        
  Call to undefined method Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandler()  
                                                                                                 

Try editing composer.json and set laravel/framework to 5.*, e.g.

        "laravel/framework": "5.*",

Then run composer update again.
Also, make sure config/app.php exists!

WordPress – remove emoji scripts

Add following few lines into your theme functions.php file:

remove_action( 'wp_head', 'print_emoji_detection_script', 7);
remove_action( 'wp_print_styles', 'print_emoji_styles');
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );

and you are all set

WordPress disable theme update

If you have made custom changes to a WordPress theme and don’t want to upgrade to a new version, that is offered to you, open style.css in theme’s directory.
At the top you will find a big comment with theme’s version, name, author information etc.
Change the version in this comment to a big number, e.g. 9.9

Before:

Version: 1.7

After:

Version: 9.9

Go to WordPress update screen and update for this theme will disappear.

Speed up Woocommerce WordPress

Add following few lines into functions.php ( in your theme directory ), at the very bottom.


add_action( 'wp_enqueue_scripts', 'remove_woocommerce_when_not_needed', 99 );

function remove_woocommerce_when_not_needed() {
	remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );

	if ( function_exists( 'is_woocommerce' ) ) {

		if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
			// dequeue styles
			wp_dequeue_style( 'woocommerce_frontend_styles' );
			wp_dequeue_style( 'woocommerce_fancybox_styles' );
			wp_dequeue_style( 'woocommerce_chosen_styles' );
			wp_dequeue_style( 'woocommerce-general' );
			wp_dequeue_style( 'woocommerce-layout' );
			wp_dequeue_style( 'woocommerce-smallscreen' );
			wp_dequeue_style( 'sv-wc-payment-gateway-payment-form' );

			// dequeue scripts
			wp_dequeue_script( 'wc_price_slider' );
			wp_dequeue_script( 'wc-single-product' );
			wp_dequeue_script( 'wc-add-to-cart' );
			wp_dequeue_script( 'wc-cart-fragments' );
			wp_dequeue_script( 'wc-checkout' );
			wp_dequeue_script( 'wc-add-to-cart-variation' );
			wp_dequeue_script( 'wc-single-product' );
			wp_dequeue_script( 'wc-cart' );
			wp_dequeue_script( 'wc-chosen' );
			wp_dequeue_script( 'woocommerce' );
			wp_dequeue_script( 'jquery-blockui' );
			wp_dequeue_script( 'jquery-placeholder' );
			wp_dequeue_script( 'fancybox' );
			wp_dequeue_script( 'jqueryui' );
			wp_dequeue_script( 'braintree-data' );
			wp_dequeue_script( 'braintree-js' );
			wp_dequeue_script( 'sv-wc-payment-gateway-payment-form');
		}
	}
}

Scripts checks if the page you are on actually needs woocommerce component ( e.g. product page, checkout page .. ) – if not, it will remove all scripts and styles related to Woocommerce and Braintree.

It’s also possible to disable woocommerce entirely on these pages through dedicated plugin – https://wordpress.org/plugins/plugin-organizer/

Also make sure you update maximum memory limit https://phpsolved.com/wordpress-adjust-maximum-memory-limit/