Skip to content

How to install LGSL

Neon edited this page Jun 17, 2021 · 15 revisions

Note that your hosting have to be able to send queries to gameservers!

Install with Composer:

composer require tltneon/lgsl: "~6.0.0"

After that you can use LGSL as regular or as library:

Example 1:

include('lgsl/lgsl_files/lgsl_class.php');
$result = lgsl_query_live('urbanterror', '176.9.28.206', 27971, 27971, 0, "sep");
print_r($result);

Example 2:

include('lgsl/lgsl_files/lgsl_class.php');
$result = lgsl_query_live('discord', 'nDuNTC6', 1, 1, 0, "sep");
print_r($result);

Default install:

If you want to setup on your PC

  • Download and Setup WebServer (NginX or Apache)

  • Download and Setup PHP (PHP)

  • Download and Setup prefered database: MySQL or MariaDB.

Create empty database (for example: lgsl)

Note: For easiest way you may use WinNMP or XAMPP or AMMPS

Installation

  1. Download stable version or latest commit. of LGSL. (*Note that commit can have any bugs)
  2. Unzip on your website. (for example to: //wwwroot/lgsl)

  1. Open your LGSL (for example: http://your.awesome.website.com/lgsl/)

  1. Go to Installation page and fill inputs with your database credentials (db server ip, db username, db password, database name)

  1. Choose LGSL table name and click on "Create table".
  2. Fill remaining inputs (lgsl admin name, password), choose LGSL style, language and other options.
  3. Click on "Generate config"
  4. Copy entire text to lgsl_files/lgsl_config.php and save.
  5. !! Delete install.php

Adding servers

  1. Go to http://your.awesome.website.com/lgsl/admin.php
  2. Use your admin login and password.
  3. On the next page add IP and connection port, choose game type (protocol) and click on "Save - Clear cache"

If you need, you can create the table manually using that SQL query:

CREATE TABLE `lgsl` ( \
  `id`         INT     (11)  NOT NULL auto_increment,\
  `type`       VARCHAR (50)  NOT NULL DEFAULT '',\
  `ip`         VARCHAR (255) NOT NULL DEFAULT '',\
  `c_port`     VARCHAR (5)   NOT NULL DEFAULT '0',\
  `q_port`     VARCHAR (5)   NOT NULL DEFAULT '0',\
  `s_port`     VARCHAR (5)   NOT NULL DEFAULT '0',\
  `zone`       VARCHAR (255) NOT NULL DEFAULT '',\
  `disabled`   TINYINT (1)   NOT NULL DEFAULT '0',\
  `comment`    VARCHAR (255) NOT NULL DEFAULT '',\
  `status`     TINYINT (1)   NOT NULL DEFAULT '0',\
  `cache`      TEXT          NOT NULL,\
  `cache_time` TEXT          NOT NULL,\
  PRIMARY KEY (`id`)\
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;

Troubleshooting

Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in ***\html\lgsl\lgsl_files\lgsl_class.php:109

To solve that problem you need to uncomment next line into php.ini:

;extension=mysqli

turn into:

extension=mysqli

If it doesn't help you, you should find php\ext folder and set absolute path to mysqli lib like for example

extension=C:\nginx\php\ext\php_mysqli.dll

Unknown database 'lgsl'

Your LGSL is not installed. First you need to create database and after it create a lgsl table. Or you just have wrong configuration settings in config.php.