0

I using windows 10 creator and want to make a sample of php for test, but when run from commandline, it only showing the code

G:\xampp\htdocs\chat-box>php -v
PHP 5.6.30 (cli) (built: Jan 18 2017 19:48:22)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

G:\xampp\htdocs\chat-box>php bin\chat_server.php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use ChatWebSocket\Chat;

require dirname(__DIR__) . '/vendor/autoload.php';

$server = IoServer::factory(
    new HttpServer(
        new WsServer(
            new Chat()
        )
    ),
    8080
);
print("Hello WebSocket!")
$server->run();
G:\xampp\htdocs\chat-box>

I have never get this before. Any problem with my command?

3
  • 1
    What is the permissions on the chat_server.php file? Commented Jun 22, 2017 at 2:17
  • 4
    Does chat_server.php have the opening <?php Commented Jun 22, 2017 at 2:20
  • oh my bad, I forget this <?php. I'm wondering why notepad++ not detect that is PHP script.. Thank you mkaatman Commented Jun 22, 2017 at 2:22

1 Answer 1

6

You are missing the opening <?php tag.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.