This code in .emacs did the job: (add-hook 'php-mode-hook (lambda () (make-local-variable 'c-basic-offset) (setq c-basic-offset 2))) I failed previously because I tried to change the global `c-basic-offset`. That didn't help as the local variable generated in php-mode took precedence (I think).