Kodum Çalışmıyor, Sorun Nedir?

<?php
// set some variables
$host = "localhost";
$port = 1024;
// don't timeout!
set_time_limit(0);
// create socket
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
// bind socket to port
$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
// start listening for connections
$result = socket_listen($socket, 3) or die("Could not set up socket listener\n");

// accept incoming connections
// spawn another socket to handle communication
$spawn = socket_accept($socket) or die("Could not accept incoming connection\n");
// read client input
$input = socket_read($spawn, 1024) or die("Could not read input\n");
// clean up input string
$input = trim($input);
echo "Client Message : ".$input;
// reverse client input and send back
$output = strrev($input) . "\n";
socket_write($spawn, $output, strlen ($output)) or die("Could not write  output\n");
// close sockets
socket_close($spawn);
socket_close($socket);
?>

bir chat uygulaması yapmak için server olarak infityfree ve php scripti kullanmak istiyorum php ile socket örneği olarak bunu buldum ve denedim ama http eror 500 diye bir hata aldım nasıl çözebilirim bilen varsa yardımcı olabilir mi

Nereden, nasil aldin?

Kodu PHP komut satiri yorumlayicisi ile calistiriyorsun, degil mi, web sayfasi olarak degil?

web sayfası olarak denedim neden ki

Dahili sunucun çalışmıyor büyük olasılıkla.

başka bir php kodu denediğimde çalışıyor sorun socketi oluşturma kısmında oraya kadar sorunsuz geliyor da

Baglanti kurulup bir sey yollanana kadar sayfa acilmaz.

bkz: Soru Sorarken Sıkça Düşülen Hatalar #13

bağlantı kurunca çalışıcaksa neden socket oluşur oluşmaz hata alıyorum listen kısmı yerine