Running a WordPress site with WP-ENV

You need to install WP-ENV globally or project based first. Then, create a “.wp-env.json” file to the root folder which has “wp-content” folder in it.

.wp-env.json: (Most optimized config, here for details)

{ "core": "https://wordpress.org/wordpress-5.6-no-content.zip", "port": 80, "mappings": { "wp-content/": "./wp/wp-content" }, "env": { "tests": { "port": 8080 } } }
Code language: JSON / JSON with Comments (json)

To Run Server: (might take long at first)

wp-env start
Code language: Bash (bash)

To Import Existing DB:

wp-env run cli db import wp-content/mysql.sql
Code language: Bash (bash)

To Export DB:

wp-env run cli db export wp-content/mysql.sql
Code language: Bash (bash)

Rewrite Flush: (Not working. Enter Settings > Permalinks and click “Save”)

wp-env run cli rewrite flush --hard
Code language: Bash (bash)

To Reset DB:

wp-env run cli db reset --yes
Code language: Bash (bash)

To update upload max size:

wp-env run cli vi .htaccess
Code language: Bash (bash)

then add:

php_value upload_max_filesize "8M"
Code language: JavaScript (javascript)

I also added “max_post_size” on next line.

Going into the container shell:

wp-env run cli bash
Code language: Bash (bash)

Posted

in

, , ,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *