Quickly import DB on server

If you want to quickly import DB on your linux do this combo command, before just create that Database you want to have.

gunzip < data.mysql.gz | mysql -u root -p db_name

Quick out of memory or out of time debugging

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
ini_set('memory_limit', ''728M');
ini_set('max_execution_time', 120)

add this to index.php and see what is the output, act on that.

$_SERVER['HTTPS']='on' on reverse proxies - nginx and SSL

When using nginx and SSL and you have a problem that CSS or JS files are using HTTP in their urls and everything else is in HTTPS. The thing you need to do is use this magic

$_SERVER['HTTPS']='on';

put it in settings.php and also if you have wordpress, do the same, put it in wp-config.php it will do the same and solve the same problem.

Running mysql on mamp localy

If you have more then one mysql installed on your computer and in your path is not proper MYSQL, you should run

?/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

Stdin: is not a tty and other GIT problems when git clone

stdin: is not a tty
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = (unset)
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
remote: Counting objects: 7844, done.

Finding ib_logfile0, ib_logfile1 and ibdata1 on MAMP

ib_logfile0
ib_logfile1
ibdata1

You will need this files, probably to delete them on MAMP/MAMP PRO when changing your "innodb_log_file_size" in my.cnf
Right location is very hard to find it is /Library/Application Support/appsolute/MAMP PRO/db/mysql

Git setup with hook for post-receive.

I have setup a simple git workflow.

In one directory on server I made bare repositroy

$ mkdir git-dir && cd git-dir
$ git init --bare

and in other one a folder for my live site

$ mkdir /var/www/www.example.com

then in the git-dir folder edit the post-receive hook

Checking my.cnf settings that are not set

On my WAMP, or MAMP or normal server you may wonder what are the settings for your MySQL that are not set in my.cnf file. There are lot of them and to get quick look at defaults all you need is to run query (you can run it in phpmyadmin for example)

show variables;

and you will have all the variables and their values shown.

Drush

If you are running into this error while using drush

Directory ..../drush/cache/default exists, but is not writable. [error] Please check directory permissions.

Run this to solve it


sudo drush version
sudo chown -R $USER ~/.drush