Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions php/boot-phar.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

if ( 'cli' !== PHP_SAPI ) {
echo "WP-CLI only works correctly from the command line, using the 'cli' PHP SAPI.\n",
"You're currently executing the WP-CLI binary via the '" . PHP_SAPI . "' PHP SAPI.\n",
"In case you were trying to run this file with a web browser, know that this cannot technically work.\n",
"When running the WP-CLI binary on the command line, you can ensure you're using the right PHP SAPI",
"by checking that `php -v` has the word 'cli' in the first line of output.\n";
die( -1 );
}

// Store the path to the Phar early on for `Utils\phar-safe-path()` function.
define( 'WP_CLI_PHAR_PATH', getcwd() );

Expand Down