bin/php/updatesearchindexsolr.php
protected function getPHPExecutable()
    {
        $validExecutable = false;
        $output = array();
        $exec = 'php';
        if ( !empty( $this->Options['php-exec'] ) )
        {
            $exec = $this->Options['php-exec'];
        }
        exec( $exec . ' -v', $output );

        if ( count( $output ) && strpos( $output[0], 'PHP' ) !== false )
        {
            $validExecutable = true;
            $this->Executable = $exec;
        }

        while( !$validExecutable )
        {
            $input = readline( 'Enter path to PHP-CLI executable ( or [q] to quit )' );
            if ( $input === 'q' )
            {
                $this->Script->shutdown( 0 );
            }

            exec( $input . ' -v', $output );

            if ( count( $output ) && strpos( $output[0], 'PHP' ) !== false )
            {
                $validExecutable = true;
                $this->Executable = $input;
            }
        }
    }
protected function getPHPExecutable()
    {
        $validExecutable = false;
        $output = array();
        $exec = 'php';
        if ( !empty( $this->Options['php-exec'] ) )
        {
            $exec = $this->Options['php-exec'];
        }
        exec( $exec . ' -v', $output );

        if ( count( $output ) && strpos( $output[0], 'PHP' ) !== false )
        {
            $validExecutable = true;
            $this->Executable = $exec;
        }

        while( !$validExecutable )
        {
            $input = readline( 'Enter path to PHP-CLI executable ( or [q] to quit )' );
            if ( $input === 'q' )
            {
                $this->Script->shutdown( 0 );
            }

            exec( $input . ' -v', $output );

            if ( count( $output ) && strpos( $output[0], 'PHP' ) !== false )
            {
                $validExecutable = true;
                $this->Executable = $input;
            }
        }
    }
protected function getPHPExecutable ( ) { $ validExecutable = false ; $ output = array ( ) ; $ exec = 'php' ; if ( ! empty ( $ this -> Options [ 'php-exec' ] ) ) { $ exec = $ this -> Options [ 'php-exec' ] ; } exec ( $ exec . ' -v' , $ output ) ; if ( count ( $ output ) && strpos ( $ output [ 0 ] , 'PHP' ) !== false ) { $ validExecutable = true ; $ this -> Executable = $ exec ; } while ( ! $ validExecutable ) { $ input = readline ( 'Enter path to PHP-CLI executable ( or [q] to quit )' ) ; if ( $ input === 'q' ) { $ this -> Script -> shutdown ( 0 ) ; } exec ( $ input . ' -v' , $ output ) ; if ( count ( $ output ) && strpos ( $ output [ 0 ] , 'PHP' ) !== false ) { $ validExecutable = true ; $ this -> Executable = $ input ; } } }
Get PHP executable from user input. Exit if php executable cannot be
found and if no executable is entered.
Get PHP executable from user input . Exit if php executable cannot be found and if no executable is entered .