VVV is configured to write the WP_DEBUG
log to ~/wp-content/debug.log
rather
than printing those messages to the screen.
This can be disabled on a per-site basis by changing the WP_DEBUG_LOG
constant
to false
.
Flush the rewrite rules in wp-admin
under VIP > Dashboard > Rewrite Rules.
There are several options for adopting the latest VVV configuration.
- Start fresh:
- Run
vagrant destroy
- Delete the VVV directory
- Check out VVV, drop in the new configuration, and provision
- Run
- Migrate to a fresh instance:
- Run
vagrant destroy
- Copy the database backups to a safe location (from
database/sql/backups
) - Delete the VVV install and start anew
- Import the database backup and update URLs
- Copy the database backup to the new site's VVV folder
- Run
vagrant ssh
and change to the new site's directory - Run
wp db import [FILE]
- Run
wp search-replace [OLD URL] [NEW URL]
- Flush the cache:
wp cache flush
- Run
- Set up a new VVV instance alongside your existing one. As long as both aren't running at the same time, they can coexist.
- Retain sites set up using
build-me-vvv.sh
(NOT RECOMMENDED):-
Modify the generated config so that the site slug and host matches what's currently in use.
-
Set the site to use the default VVV provisioner rather than our custom one, pulling from the
master
branch -
Run
vagrant destroy
andvagrant provision
The existing sites will remain, including the unused
wpcom.test
network, and you'll need to reconcile your updates with any future changes to the generated config, but this will retain all of your existing sites in case you have something set up that you cannot part with.
-
- Add it there, e.g.
php80
orphp81
. - For sites you wish to switch to the new version, update the
nginx_upstream
in the site's configuration to match the desired version, e.g.php80
. - Run
vagrant provision
.
- Update the
nginx_upstream
in the site's section ofconfig.yml
to match the desired version, e.g.php80
. - Run
vagrant provision
.
-
vagrant ssh
and change to the/etc/nginx/custom-sites
directory. -
Run
ls -la
and find the filename of the site you wish to update. It will be in the format ofvvv-[SITE_SLUG]-[HASH].conf
. -
Use the
sudo
command to edit the file identified in the previous step, e.g.sudo vim
orsudo nano
. -
Find the line that's preceded by the comment
# This is needed to set the PHP being used
. -
At the end of the following line, change the specified PHP version to the desired version.
For example, if the line was:
set $upstream php74;
And you want to set the site to PHP 8.0, change it to:
set $upstream php80;
-
Save the file and exit the editor.
-
Restart nginx by running
sudo /etc/init.d/nginx restart
.
Note that switching an individual site's PHP version applies only to the web server, but does not affect the PHP version used by WP-CLI. Additionally, the WP_CLI_PHP
environment variable has no effect on the PHP version used by the copy of WP-CLI installed in the VM.
To run WP-CLI with a different PHP version, such as PHP 8.0:
/usr/bin/php8.0 /usr/local/bin/wp [COMMAND]
The two available PHP versions, and their paths, are:
- 8.0:
/usr/bin/php8.0
- 8.1:
/usr/bin/php8.1
To confirm which PHP version is used by WP-CLI, run:
/usr/bin/php8.0 /usr/local/bin/wp cli info
Confirm that the PHP version
and php.ini used
lines reference the
expected version.
First, make sure you have php 8 installed (see above in the FAQ).
The steps to install are in the unit testing docs. PHP8 requires us to use PHPUnit 9, which requires us to use the WordPress 6 test suite and add the yoast/phpunit-polyfills. They are very similar to how phpunit7 was installed, but you should still follow them from the beginning as you are installing new versions of phpunit and the wordpress test suite, as well as a new composer package.
Any time you are using a specific version of php to run a command, you need the full path, i.e. php8.0 /usr/local/bin/composer ...
instead of just php8.0 composer ...
.
You can keep your existing theme wp-tests-config.php, but you will need to add a new constant: define('WP_TESTS_PHPUNIT_POLYFILLS_PATH', '/home/vagrant/vendor/yoast/phpunit-polyfills/');