Drupal Dump

Drupal Snippets, Hacks and more....

495 posts since 2011

LEMP, NGINX stack - Only home page works fine, all others give 404 error

If you have a problem where you have LEMP Stack (Nginx instead of apache) and you get 404 on all pages but front you probably need to change one line in your "/sites-enabled/your-iste" file. So lets open this nginx file that defines virtual block and change the part under "location" directive from
 

Installing composer on dedicated server

If you are having problems with installing composer on your dedicated server try it like this

sudo curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

also check if you have openssl enabled as extension in your php.ini (this depends on php version)

Using GIT with drupal7, do not put core into GIT

This is tutorial how to setup a drupal 7 site with git but without putting drupal core into git, reason is that you don't need it in git unless you are patching core. As drupal core is always the same and updated with drush, version control is not needed at least there is a stream of opinion that goes into that direction.  So what do you do, you only put sites folder into git.

Drush download drupal 7 into the current directory

For drupal 8 you will probably use more complex framework with composer at leas but for drupal 7 you still might use drush just to download drupal core. So to do that into the current directory you are at, use this command

drush dl drupal-7.x --drupal-project-rename="../${PWD##*/}" -y

It will overrun everything you have in that directory.

Logging arrays with logger

In drupal 8 for logging we use logger service, to log array data in some readable format, you should use little hack like in drupal 7 adding html code and print_r to array.

First drush driver behat test

With drush driver for behat you will have some more power, basically drush power to do things. So to make out first drush test, you will need to bring some change in behat.yml file and change some lines.