Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions features/server.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ Feature: Serve WordPress locally
256M
"""

Scenario: Custom ini configuration
Given a WP install
And a mem.php file:
"""
<?php echo ini_get('memory_limit'); ?>
"""
And a custom.ini file:
"""
memory_limit = 512M
"""
And I launch in the background `wp server --host=localhost --port=8188 --config=custom.ini`

When I run `curl -sS localhost:8188/mem.php`
Then STDOUT should be:
"""
512M
"""

Scenario: Access wp-login.php
Given a WP install
And I launch in the background `wp server --host=localhost --port=8185`
Expand Down
14 changes: 10 additions & 4 deletions src/Server_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,23 @@ public function __invoke( $args, $assoc_args ) {
}

// Add the server flags
$cmd_format .= ' -S %s -t %s -c %s %s';
$cmd_format .= ' -S %s -t %s';
$cmd_args[] = $assoc_args['host'] . ':' . $assoc_args['port'];
$cmd_args[] = $docroot;
$cmd_args[] = $assoc_args['config'];
$cmd_args[] = (string) $docroot;

if ( ! empty( $assoc_args['config'] ) && is_string( $assoc_args['config'] ) ) {
$cmd_format .= ' -c %s';
$cmd_args[] = $assoc_args['config'];
}

$cmd_format .= ' %s';
$cmd_args[] = Utils\extract_from_phar( $router_path );

$cmd = Utils\esc_cmd( $cmd_format, ...$cmd_args );

$descriptors = array( STDIN, STDOUT, STDERR );

if ( Utils\get_flag_value( $assoc_args, 'adapt-scheme', false ) ) { // @phpstan-ignore argument.type
if ( Utils\get_flag_value( $assoc_args, 'adapt-scheme', false ) ) {
putenv( 'WPCLI_SERVER_ADAPT_SCHEME=1' );
}

Expand Down
Loading