fewagency / boilerplate-pattern-library

A boilerplate for a PHP project with a macropiche pattern-library
1 stars 1 forks source link

Document install of wordpress #10

Closed bjuppa closed 8 years ago

bjuppa commented 8 years ago

We've tried all kinds of composer based installs of wordpress, but they all have in common that they install wp in a subdirectory to public/ or web/ which doesn't work well with wordpress multisite - see https://core.trac.wordpress.org/ticket/36507

https://roots.io/bedrock/ https://wordplate.github.io

This guide is a bit old but interesting: https://roots.io/using-composer-with-wordpress/

I haven't tested these: https://github.com/gwa/bedrock-multisite-skeleton https://github.com/gwa/WpMultisiteDirectoryResolver

bjuppa commented 8 years ago

The most successful way so far is to install wordpress from zip file in the public/ directory:

curl -sS https://wordpress.org/wordpress-4.6.1.tar.gz | tar --strip-components=1 -xvz -C public

That can be run in a deploy script or in composer.json like so:

"scripts": {
    "post-install-cmd": ["curl -sS https://wordpress.org/wordpress-4.6.1.tar.gz | tar --strip-components=1 -xvz -C public"]
  }

One could also add this to the post-install-cmds to create wp-config.php unless it exists:

"php -r \"file_exists('public/wp-config.php') || copy('public/wp-config-sample.php', 'public/wp-config.php');\""

Also add all the wp-stuff to .gitignore to not check it in.

bjuppa commented 8 years ago

.gitignore the files copied in from the wordpress install zip:

/public/wp-*
/public/index.php
/public/xmlrpc.php
/public/license.txt
/public/readme.html
bjuppa commented 8 years ago

After download follow https://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install

bjuppa commented 8 years ago

Here's a Valet Driver for this wordpress setup: https://gist.github.com/bjuppa/f11c842fc5e7c5576b3f2c96583f8625

bjuppa commented 8 years ago

Then setup multisite following this: https://codex.wordpress.org/Create_A_Network#Step_2:_Allow_Multisite

I've now confirmed, this procedure is actually working!