Monday, 16 October 2017

Wordpress: Change the title of any custom page dynamically

Sometime we want to custom the title for some page eg: 404, contact, search .... It is very simple, follow these instructions.

in file "your_theme/function.php" add the following code at the end.

function setTitle($title) {
    add_filter( 'wp_title', function() use ($title) {return $title;}, 10000 );
}

Done ! From now on, which page should be customized so that you just call the function like this:

setTitle('Hello, this is my custom title');

It does not affect the pages you do not use. Have fun!

Sunday, 12 March 2017

Yii2: PHP Warning - Unable to allocate memory for pool

Yii2 error:

PHP Warning – yii\base\ErrorException

include(): Unable to allocate memory for pool.


* Reason : You have not allocated enough memory for APC cache (file cache or opcode cache)

* Solution 1: Disable APC, If you do not need it (apc.enabled=0)
* Solution 2: Increased memory for APC (apc.shm_size="64")

To do one of the two. Find php.ini or apc.ini on your server. If you do not have admin rights to the server try to use htacess file: php_flag display_errors on