WordPress 4.4 - Deploy fails at task "WordPress Installed?"

I haven’t had this issue before, when I try to deploy a new project (with the latest Trellis and Bedrock), I get this error:

TASK: [deploy | WordPress Installed?] ***************************************** failed: [my.server.ip] => {"changed": false, "cmd": ["wp", "core", "is-installed"], "delta": "0:00:00.206963", "end": "2015-12-10 09:49:38.316217", "failed": true, "failed_when_result": true, "rc": 255, "start": "2015-12-10 09:49:38.109254", "stdout_lines": [], "warnings": []} stderr: PHP Warning: require(/srv/www/staging.mydomain.nl/releases/20151210094918/web/wp/wp-includes/embed-functions.php): failed to open stream: No such file or directory in phar:///usr/bin/wp/php/utils-wp.php on line 62 Warning: require(/srv/www/staging.mydomain.nl/releases/20151210094918/web/wp/wp-includes/embed-functions.php): failed to open stream: No such file or directory in phar:///usr/bin/wp/php/utils-wp.php on line 62 PHP Fatal error: require(): Failed opening required '/srv/www/staging.mydomain.nl/releases/20151210094918/web/wp/wp-includes/embed-functions.php' (include_path='phar:///usr/bin/wp/vendor/phpunit/phpunit-mock-objects:phar:///usr/bin/wp/vendor/phpunit/php-token-stream:phar:///usr/bin/wp/vendor/phpunit/php-code-coverage:phar:///usr/bin/wp/vendor/phpunit/phpunit:phar:///usr/bin/wp/vendor/symfony/yaml:.:/usr/share/php:/usr/share/pear') in phar:///usr/bin/wp/php/utils-wp.php on line 62 Fatal error: require(): Failed opening required '/srv/www/staging.mydomain.nl/releases/20151210094918/web/wp/wp-includes/embed-functions.php' (include_path='phar:///usr/bin/wp/vendor/phpunit/phpunit-mock-objects:phar:///usr/bin/wp/vendor/phpunit/php-token-stream:phar:///usr/bin/wp/vendor/phpunit/php-code-coverage:phar:///usr/bin/wp/vendor/phpunit/phpunit:phar:///usr/bin/wp/vendor/symfony/yaml:.:/usr/share/php:/usr/share/pear') in phar:///usr/bin/wp/php/utils-wp.php on line 62

Not sure what I’ve done wrong here or if it’s a bug. Any help would be appreciated!

Cheers,
Richard

All of the errors to a missing wp-include/embed-functions.php. Wordpress 4.4.0 has some new embed functionality. In the final release these are in embed.php and embed-template.php, but during development it looks like there was an embed-functions.php at some point.
Have you updated recently? Check the composer.json under you site folder and run a composer update. For WordPress 4.4.0, you should have this as a require statement : “johnpbloch/wordpress”: “4.4.0”,

After upgrading to Wordpress 4.4 I started to get a similar error when trying to deploy:

TASK: [deploy | WordPress Installed?] ***************************************** failed: [46.101.217.38] => {"changed": false, "cmd": ["wp", "core", "is-installed"], "delta": "0:00:00.260645", "end": "2015-12-10 21:38:46.873124", "failed": true, "failed_when_result": true, "rc": 255, "start": "2015-12-10 21:38:46.612479", "stdout_lines": [], "warnings": []} stderr: PHP Fatal error: Class 'WP_Widget' not found in /srv/www/staging.example.com/releases/20151210213809/web/wp/wp-includes/widgets/class-wp-widget-pages.php on line 17 Fatal error: Class 'WP_Widget' not found in /srv/www/staging.example.com/releases/20151210213809/web/wp/wp-includes/widgets/class-wp-widget-pages.php on line 17

All you need to do is upgrade WP-CLI:

sudo wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/bin/wp

See http://wp-cli.org/blog/version-0.20.3.html for more info

9 Likes

Thank you! Works now

Thank you, that solved it!

I’m having this same issue, but the prescribed fix doesn’t work. I’m still getting an error:

Error: The downloaded PHAR is broken, try running wp cli self-update again.

I’ve tried tracking down the issue and I think it’s because I’m trying to run the update command with the --allow-root flag.

You can always just update Trellis with this PR and re-provision your server.

I’m using the latest version of Trellis (at least on my local?) but the re-provision fails on the production server (because WP CLI is out of date?). When I try to re-provision it fails on the wordpress installed? task and I get the error:

PHP Warning:  Unterminated comment starting line 15 in phar:///usr/local/bin/wp/php/wp-cli.php(23) : eval()'d code on line 15

I check my WP CLI and see it is still on version 0.19.1 so I go and try to update it (first with my web user):

wp cli update
Error: /usr/local/bin/wp is not writable by current user

Hmm, so I try it as root:

wp cli update --allow-root
You have version 0.19.1. Would you like to update to 0.21.1? [y/n] y
Downloading from https://github.com/wp-cli/wp-cli/releases/download/v0.21.1/wp-cli-0.21.1.phar...
Error: YIKES! It looks like you're running this as root. You probably meant to run this as the user that your WordPress install exists under.

If you REALLY mean to run this as root, we won't stop you, but just bear in mind that any code on this site will then have full control of your server, making it quite DANGEROUS.

If you'd like to continue as root, please run this again, adding this flag:  --allow-root

If you'd like to run it as the user that this site is under, you can run the following to become the respective user:

sudo -u USER -i -- wp <command>


PHP Warning:  max(): Array must contain at least one element in phar:///usr/local/bin/wp/php/WP_CLI/Loggers/Regular.php on line 87


Error: The downloaded PHAR is broken, try running wp cli self-update again.

That makes it seem like the --allow-root flag isn’t actually getting picked up? I also tried updating WP CLI via the wget command mentioned above:

sudo wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/bin/wp

But that doesn’t seem to update WP CLI either. Sorry, I can create a new thread if this doesn’t belong here.

Did you run wp --version and see what version it is? It should show 0.21.1

Yeah I checked it, wp cli version gave me 0.19.1

EDIT:

I figured this had something to do with incorrect permissions with my web user, I ended up getting WP CLI updated by doing the following:

sudo chown -R web /usr/local/bin/wp
sudo chown -R web /tmp
su web
wp cli update
You have version 0.19.1. Would you like to update to 0.21.1? [y/n] y
Downloading from https://github.com/wp-cli/wp-cli/releases/download/v0.21.1/wp-cli-0.21.1.phar...
New version works. Proceeding to replace.
Error: Cannot move /tmp/wp_5682d9c5a44ec.phar to /usr/local/bin/wp
exit [back to root]
mv /tmp/wp_5682d9c5a44ec.phar /usr/local/bin/wp
su web && wp cli version
WP-CLI 0.21.1

It seems like I setup the web user permissions wrong or something. Now I’m able to re-provision the production server! Unfortunately, still cannot deploy and it fails on the WordPress Installed? task with this error:

PHP Warning:  Unterminated comment starting line 15 in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(731) : eval()'d code on line 15

That error is coming from here: https://github.com/wp-cli/wp-cli/blob/21da8b4ebf7f37f9ae55b45b037214f154a1b2ab/php/WP_CLI/Runner.php#L731

// Load wp-config.php code, in the global scope
eval( $this->get_wp_config_code() );

So PHP is encountering an error reading your wp-config.php on line 15. The actual problem might be further down in config/application.php but either way you need to make sure it’s all valid PHP code.

This is also a separate problem from your original reply and no longer related to this thread.