A real-time chat application using PHP, WebSockets, and MySQL. It includes user login, real-time communication, and message storage.
- User login
- Real-time communication using WebSockets
- Online user list
- Private messaging
- Message storage in MySQL
- PHP 7.0+
- Composer
- MySQL
- OpenSSL (for secure WebSocket connections)
- A web server (e.g., Apache, Nginx)
-
Clone the Repository:
git clone https://github.com/aniketniet/Realtime-Chat-Using-PHP-Socket.git cd real-time-chat-app
-
Install Dependencies:
composer install
-
Configure MySQL Database:
- Create a MySQL database and import the
chat_db.sql
file. - Update
config.php
with your database credentials.
- Create a MySQL database and import the
-
Configure SSL:
currently not avalable
-
Start the WebSocket Server:
php server.php
-
Place Client Files on Web Server:
- Ensure
index.html
,chat.php
,store_message.php
, andconfig.php
are in your web server’s document root.
- Ensure
-
Access the Application:
- Open a web browser and navigate to your server’s address, e.g.,
https://yourserver.com/index.html
.
- Open a web browser and navigate to your server’s address, e.g.,