• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

MySQL From nothing to a fully working, secured OT server. [Uniform Server] + [TFS 0.3.6]

Status
Not open for further replies.

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
7,030
Solutions
256
Reaction score
2,115
Location
Norway
GitHub
Znote
This is out dated and converted to a VIDEO tutorial!

Please view it here:
http://otland.net/f479/video-tutorial-nothing-fully-working-ot-server-website-shop-system-166818/

Thread closed.





















































































//If you encounter any problems, check our Troubleshooting section HERE before replying.

Hello, there has been quite a while since I made a tutorial. But I figured this would be a good time.

I was searching the web, looking for alternatives to XAMPP, because using XAMPP for this Open Tibia community is a really bad habit!

XAMPP is for testing purposes mainly for your local machine, if you get into problems using XAMPP, and posting it at their forum, they will stamp you "IDIOT" in your head, and saying "XAMPP has never been made and probably will never be made for serious hosting".

XAMPP is made for testing purpose. And it is insecure, and heavy.

I was browsing the web, hoping to find an easier installation and use alternative to xampp.

And that is Uniform Server.

Why use Uniform Server instead of XAMPP?
1. Security
2. Lightweight (xampp 51MB, XAMPlite 28MB. Uniform Server 8.75MB).
3. Easier to use.
4. XAMPP got lots of unnecessary features, especially for the Open Tibia community. Despite the small size of Uniform Server, it has all we need.

Installing Uniform Server will give you:
MySQL database.
phpMyAdmin to administrate the MySQL database.
Apache hosting.
PHP 5.3.5+
eAccelerator to make website faster.

XAMPP + Modern AAC = Page rendered in: 0.0554 seconds.
Uniform Server + Modern AAC = Page rendered in: 0.0219 seconds.

Do I need to say more? So lets get started!

Getting Started:

First we need to download latest version of Uniform Server, download it at this link:
Version: 7.0.1 Windows 7/2008 32 & 64bit users.
7.0.1 download from SourceForge.net

Version: 5.7.5 Windows XP 32bit users.
5.7.5 download from SourceForge.net

If the links from sourceforge dont work, feel free to use my alternative uploads:
~Edit: alternative uploads temporarily unavailable~
If you are having problems with the sourceforge links above, reply on this thread and I will fix alternative mirrors again.
If you dont, I wont add alternative mirrors any longer. If people dont need it, then its waste of time for me. :p

UniServer 7.0.1-Orion Released:
Core components:
Apache 2.2.17
MySQL 5.5.11 - Update
PHP 5.3.6
phpMyAdmin 3.3.10 - Update
Go-Pear 1.1.2
msmtp 1.4.23
eAccelerator 1.0-snv427
WinBinder 2010.10.14
OpenSSL 1.0.0d

Regards,
The Uniform Server Development Team

Code:
UniServer 5.7.5-Nano:
Core components:
Apache 2.2.17
MySQL 5.5.10 -- Update
PHP 5.3.5
phpMyAdmin 3.3.9.2 
Go-Pear 1.1.2
msmtp 1.4.23
eAccelerator 1.0-snv427
OpenSSL 0.9.8q

When running the program, it will ask to install it to something bothersome like:
C:Usersprogram files
or something similar.

Don't install it there, you can do it, but windows filesystem is crap so we want to save it as close root as possible.

So install it directly to
C:
2900-uni1.png


And click Extract.

Installation complete. That wasn't so hard?

But we still need to learn to configure and use it, lets get to that now:
2901-uni2.png

Click Start.

Whohaw! You started it!

OMG! POPUP MSG; your computer will crash
2902-uni3.png

Just kiddin.

The message simply says there will be an icon at the bot, the icon with "1".

That little icon is the configuration panel of Uniform server. :)

Right click = Services
Left click = Start without running as services.

Services = It will start automatic, if you restart your computer, it will automatic restart so you won't have to click "start".

2903-uni4.png


start and Stop UniServer = start and stop the website and Mysql database.

If you click on Stop while your OT server is running your in problems. Since you close the MySQL database. So don't do that while OT is online!

What else is useful is phpMyAdmin, click on it and you will connect to phpMyAdmin, so you don't need to remember the address.

What else which is very useful is "Server Status". Lets click it:
2904-uni5.png


Now that's awesome!
This tells you your global IP address, this is the IP you are suppose to paste in config.lua on your OT server!
Code:
Your Internet IP Address = 85.19.89.238

Can other players see your website? Have you opened the necessary ports and everything is working fine? On my school computer, NO!
Code:
Accessible from Internet = NO

Port 80 is default, if you choose another port, when you enter your website, you need to write :xxxx (depending on port). However, with port 80 this is not neccesary.

Make sure to port forward port 80.
Code:
Apache port            = 80

Install status, if "as program" it is running, but it will not restart and such things automatic. If running as Services, it will boot automatic when computer restarts and such things.
Code:
install status  = Installed as a standard program

This here is also good, it tells you if the ports are available, and if they are in use, what program is using them!
Code:
 PORT STATUS:

   Apache port     = 80 In use by this server
   Apache SSL port = 443 SSL Not enabled free to use
   MySQL port      = 3306 In use by this server
Code:
For security reasons, do NOT port/open MySQL port. We don't want outsiders to sneak in our database.

Now start uniserver, and click "Admin Panel"
2905-uni6.png


Fix the security steps:
2906-uni7.png


Once you have done the 4 steps click on "security console" on this message:
Code:
Run the Security Console and see if everything is OK.

2907-uni8.png


Code:
Server Certificate and Key (SSL) 
Unsecure indicates you do not have a server certificate or key. Create new ones by clicking the UNSECURE link.

UNSECURE
You are not using SSL, but just to be kind, we like to keep things secured, click on "Unsecure" and set a password there as well.

Don't secure php safe mode. Its no point in doing it.

Having this as "Unsecured" should not be a problem tho. Correct me if I am wrong if you know why we should keep it secured.

And thats it, you have secured the basics.

However, we can still do some fine tuning on phpmyadmin. Lets configure it now!

2909-uni10.png


2910-uni11.png


2908-uni9.png


We don't need 2 root accounts, so we shall delete 1 of them. Lets keep 127.0.0.1 since it has bigger compatibility than localhost. (Does not matter much anyway, you can connect to 127.0.0.1 using localhost on windows anyway).

To avoid standard hijacking programs, lets rename the remaining root user into our own custom root username!
2911-uni13.png


Thumb rule1: Never connect to database with a root user. Do not use this user when you connect your OT to your database. I will explain further later.

2912-uni14.png


Ohh shit!
2913-uni15.png


Don't worry! If you got this error, it means it WORKED PERFECTLY AS WE WANTED IT TO! :D So now is the time to say "Wohoo!". :D

But well, lets make sure we can access our secured phpmyadmin. D:

Enter
Code:
C:\UniServer\home\admin\www\phpMyAdmin

and look for file named:
config.inc.php

Open it in notepad++. Or regular notepad. (Text document).
2914-uni16.png


Change from:
PHP:
$cfg['Servers'][$i]['auth_type']       = 'config';  // Authentication method (config, http or cookie based)?

TO:
PHP:
$cfg['Servers'][$i]['auth_type']       = 'cookie';  // Authentication method (config, http or cookie based)?

Don't change anything else here, don't change root to your new root name or anything like this. Just leave it root here, for security reasons.

Scroll a little down and you see:
PHP:
/* PMA User advanced features */
$cfg['Servers'][$i]['controluser']    = 'pma';
$cfg['Servers'][$i]['controlpass']    = '';

change
PHP:
$cfg['Servers'][$i]['controlpass']    = '';

To a 8 numbered long password! Remember this password since we need to configure phpMyAdmin later with it!

Now we re-enter phpMyAdmin:
2909-uni10.png


And you get this result, now login with your edited root account:
2915-uni17.png


Problem shooting:
I got some problems here, i could not login with my new username.

How I fixed this:
Click "stop UniServer"
and then click
"start UniServer".

If that does not work, try to do a computer restart to clear out the cache. Or click ctrl + F5 to reload phpMyAdmin without cache.

If reloading site without cache does not work, reboot your computer,(to control check that the programs are properly turned off) And then login again. Make sure you login with your correct new username and password and not root!

After a computer reboot it worked for me, and I got in. :)

2919-uni18.png


Remember we added a password to pma? Now add that password here, that way, even though pma 'might' be harmless, it is secured. :D
 
Last edited:
Now lets getting started with the OT server!

It does not matter what OT server you want to run, but this tutorial will use the latest official TFS server available.
You can download it at this link:
http://otland.net/f18/8-54-forgotten-server-0-3-6pl1-crying-damson-59924/

Create a folder directly in C:\ named "OTserver".

And extract the server there, so the data dir would be:
Code:
C:\otserver\data

Now enter this link:
http://otland.net/f18/opentibia-dll-files-v1-4b-1042/

And download the DLL files.

Extract the DLL files directly in to
Code:
C:\otserver
2920-uni19.png


Now enter phpmyadmin, and create a user for the OT server on the mySQL database!
2921-uni20.png


This is a bit long image, make sure to click to enlarge it if you don't understand!
2922-uni21.png


In import section, click browse, or choose file, or in case of Norwegian, "Velg Fil".
2923-uni22.png


Locate your OT server, click on schemas and click on MySQL.sql
C:\otserver\schemas\

2924-uni23.png


phpMyAdmin said:
Import has been successfully finished, 71 queries executed.

Now, open Config (sometimes it may appear as Config.lua).
2920-uni19.png


Open it with a text document, and search for "sqltype"

You should find this:
Code:
	[B][COLOR="green"]sqlType = "mysql"[/COLOR][/B]
	[B][COLOR="green"]sqlHost = "localhost"[/COLOR][/B]
	[COLOR="Red"][B]sqlPort = 3306[/B][/COLOR]
	[COLOR="DarkOrange"][B]sqlUser = "otland"[/B][/COLOR]
	[COLOR="DarkOrange"][B]sqlPass = "F9quqSU65DctHJV3"[/B][/COLOR]
	[COLOR="DarkOrange"][B]sqlDatabase = "otland"[/B][/COLOR]
	[COLOR="red"]sqlFile = "forgottenserver.s3db"[/COLOR]
	[COLOR="red"]sqlKeepAlive = 0[/COLOR]
	[COLOR="red"]mysqlReadTimeout = 10[/COLOR]
	[COLOR="Red"]mysqlWriteTimeout = 10[/COLOR]
	[COLOR="green"][B]encryptionType = "sha1"[/B][/COLOR]

GREEN = Write exactly as appear on my config.
ORANGE = Write your phpMyAdmin database username and password. In sqlPass write the automatic generated password!
RED = Don't do anything. :p
Also make sure encryption is sha1! Do not use plain, or md5.

http://www.sha1.cz/
This is a plain --> sha1 password generator. You can write "test" and click generate, and you will get the sha1 encrypted "test" which is "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3". You can then copy the sha1 encrypted password into an account in phpmyadmin, and login with those details. Very useful site.

This is very important, if you use Plain, your server may easily get hacked!

After this, save config, and run server!
PHP:
[13/04/2010 18:28:20] The Forgotten Server, version 0.3.6 (Crying Damson)
[13/04/2010 18:28:20] Compiled with GNU C++ version 3.4.5 (mingw special) at Dec 24 2009, 10:39:30.
[13/04/2010 18:28:20] A server developed by Elf, slawkens, Talaturen, KaczooH, Lithium, Kiper, Kornholijo.
[13/04/2010 18:28:20] Visit our forum for updates, support and resources: http://otland.net.

[13/04/2010 18:28:20] >> Loading config (config.lua)
[13/04/2010 18:28:20] > Using MD5 encryption
[13/04/2010 18:28:20] >> Checking software version... up to date!
[13/04/2010 18:28:20] >> Fetching blacklist
[13/04/2010 18:28:20] >> Loading RSA key
[13/04/2010 18:28:20] >> Starting SQL connection
[13/04/2010 18:28:20] >> Running Database Manager
[13/04/2010 18:28:21] > No tables were optimized.
[13/04/2010 18:28:21] >> Loading items
[13/04/2010 18:28:21] >> Loading groups
[13/04/2010 18:28:21] >> Loading vocations
[13/04/2010 18:28:21] >> Loading script systems
[13/04/2010 18:28:21] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/annihilator.lua:5: '}' expected (to close '{' at line 1) near 'entry'
[13/04/2010 18:28:21] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/annihilator.lua)
[13/04/2010 18:28:21] data/actions/scripts/quests/annihilator.lua:5: '}' expected (to close '{' at line 1) near 'entry'
[13/04/2010 18:28:21] >> Loading chat channels
[13/04/2010 18:28:21] >> Loading outfits
[13/04/2010 18:28:21] >> Loading experience stages
[13/04/2010 18:28:21] >> Loading monsters
[13/04/2010 18:28:21] >> Loading mods...
[13/04/2010 18:28:21] > Loading buypremium_command.xml... done.
[13/04/2010 18:28:21] > Loading changender_command.xml... done.
[13/04/2010 18:28:21] > Loading custommonsters.xml... done.
[13/04/2010 18:28:21] > Loading customspells.xml... done.
[13/04/2010 18:28:21] > Loading firstitems.xml... done.
[13/04/2010 18:28:21] > Loading highscorebook.xml... done.
[13/04/2010 18:28:21] > 6 mods were loaded.
[13/04/2010 18:28:21] >> Loading map and spawns...
[13/04/2010 18:28:21] > Map size: 1000x1000.
[13/04/2010 18:28:21] > Map descriptions: 
[13/04/2010 18:28:21] "Saved with Remere's Map Editor 1.1.8"
[13/04/2010 18:28:21] "The Forgotten Server"
[13/04/2010 18:28:22] > Map loading time: 0.783 seconds.
[13/04/2010 18:28:22] > Data parsing time: 0.07 seconds.
[13/04/2010 18:28:22] > Houses synchronization time: 0.022 seconds.
[13/04/2010 18:28:22] > Content unserialization time: 0.316 seconds.
[13/04/2010 18:28:22] >> Checking world type... PvP
[13/04/2010 18:28:22] >> Initializing game state modules and registering services...
[13/04/2010 18:28:22] > Global address: 127.0.0.1
[13/04/2010 18:28:22] > Local ports: 7171	7172	
[13/04/2010 18:28:22] >> All modules were loaded, server is starting up...
[13/04/2010 18:28:22] >> Forgotten server Online!
Working! :thumbup:

Now lets try to LOGIN!
PHP:
[13/04/2010 18:30:22] Account Manager has logged in.
[13/04/2010 18:30:22] > Broadcasted message: "New record: 1 players are logged in.".

Everything seem to be fine. Following this tutorial, will definetely help you with your security, however, there are still many more security measures you can do, but so long, I haven't had any problems with it. :)

Installing a website to Uniform Server

Dedicated guide created for making Modern AAC on Uniform Server!
View the big guide HERE.


Or follow this mini guide if you already are familiar with it.

Mini Guide:

Here is a quick guide to do it until I finish the detailed version:

After you have configured Uniform Server properly as I described in this thread.

Download latest rev of Modern AAC

Remove everything in the folder named "www" and put in the Modern AAC files there.

Enter:
UniServer\usr\local\php

Open the file "php" or "php.ini" in a text document and search for:

;extension=php_pdo_mysql.dll

Then remove the (;) so the result is:

extension=php_pdo_mysql.dll

Then click "Stop Uniserver".

Wait 5 - 10 sec, and then click "Start Uniserver".

Then enter website 127.0.0.1 and you will get to modern aac installation website.

After installation, remove everything in www/install.

And it should be working fine. :)

Login to admin panel on Modern AAC to add news, pages etc.
1. Enter phpmyadmin, login, select your database, click on "account" table.

2. Find your account, click edit.

3. Change group ID to 5, and under group ID you also find "Page Access", set page access = 5

4. Login / or LOGOUT THEN login to your admin account

5. Now at bottom of the page, there should be a link "Administration" or something like that. Click it!

6. Now your in admin panel. You can check updates, RSS feed, you can add news, add pages and systems, browse and edit database in Scaffolding system etc...

Thats it, hope you learned something new! :)

I might continue developing this thread, but for now thats it! Hope you like it!

Now, after writing this time-eating tutorial, posting images, everything, all I ask...

Is if you can come with a comment. :)

Feel free to ask questions regarding this. :)
 
Last edited:
Troubleshooting:
I cant run UniTray! It wont start at all!
You need to download and install this file, then you can run UniTray (Start Uniform Server):
Download details: Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)
(Tested and works on Windows Server 2008). Thanks to Teh Maverick for testing it.

Is any ports being used by another program?(Example port 80).
Make sure to turn off apache from XAMPP and uninstall it.

Port 80 is occupied by another program, and I don't have XAMPP on my computer!
Might want to warn people that using Skype prevents Apache from being installed initially, as it uses port 80.
If using skype:
https://support.skype.com/en-us/faq...-such-as-Apache-or-IIS-working-on-port-80-443

That's just my opinion, easy & quick. Great tutorial!



Still does not work?
Take a look at this guide:
Port 80 unavailable: Step-by-step guide to release port 80 and make it available for Apache Server | Featured | Technology Reviews

Forgot pass to mysql/phpmyadmin. How to recover it?
When im gonna install my modern aac this shows up:
# Could not connect to database.
# Could not find your database.

1. Never use localhost. Use the IP 127.0.0.1
2. Make a new user in phpmyadmin, make sure to write 127.0.0.1 in host instead of the default localhost (see my tutorial for more detailed information on how to do this)
3. write the correct information for this user you just made when installing website.[/quote]

Cant connect to mysql database [Case 2]:
Znote said:
Enter:
UniServer\usr\local\php

Open the file "php" or "php.ini" in a text document and search for:

;extension=php_pdo_mysql.dll

Then remove the (;) so the result is:

extension=php_pdo_mysql.dll

Then click "Stop Uniserver".

Wait 5 - 10 sec, and then click "Start Uniserver".

And it should work fine. ^^

// IF it still does not work after doing this, use Carbo 6.X.X and not 5.X.X!

I want to be able to access phpmyadmin from anywere on the Internet. So I and my friends/sub owners can access database:

The install status is Undefined!

This means the problem might be:
Your firewall. Try to disable it.
Your antivirus program. Maybe you have norton, which think the server is suspicious and have removed the program permission to run other services.
(turn it off)

Maybe you are not logged in as Administrator, but a regular user? Make sure you have administrators rights.

Maybe you installed it at wrong place? It should be installed in C:/ not C:/users/desktop (which may have lower file priority).

Try to be logged in as administrator, and try to run the program as administrator.

Status: Undefined! Basically means, the program is not having the permission to check the status on mysql and apache.

If you still have problems, try to enter your task manager, click on processes, search after mysqld.exe and apache.exe and see if those programs are running. If they are, select them and click end process. Once you have ended both of them, try to start Uniform Server again and see what happens.

Cannot start session without error messages.
I Can't log into phpAdmin, it says this
"Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly."

Edit: It doesn't work with Google Chrome, it works with Internet Explorer. any idea why?


Most likely because you used Google Chrome when following my tutorial. So the cache got fucked up when you changed from config to cookie in phpmyadmin configuration file. Chrome still thinks that you are using config instead of cookie/httpd so it gets fucked up.

Or that you are using localhost instead of 127.0.0.1, chrome got IPv6 support meaning it is not the same any longer.

Anyway, make sure to use 127.0.0.1 instead of "localhost" and do a computer reboot and your problem with google chrome should be fixed.

Thats what i get after typing

http://localhost/apanel/phpmyadmin/

PHP:
phpMyAdmin - Error

Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.

Any idea?

The cache on your web browser got messed up when you changed your phpmyadmin from config to cookie/httpd.
Use another browser, or reboot your computer. Or clear the browsers cache.

Example: If you got this error on google chrome, use firefox or IE. If you got this message on Firefox or IE, use google chrome.[/quote]

PMA controluser problems.
Znote said:
Drullen said:
Hello, I was setting up my uniform server. And when I try to go to Privileges I write my Username and password and I get this error

Connection for controluser as defined in your configuration failed.
This is because you changed the password to pma. You have to paste the new pma password in config.inc.php (phpmyadmin configuration file, same place as where you change from config to cookie/httpd just a little bit more down).

If you are confused, do like this:
Enter phpmyadmin, click on priviledges, edit pma, click generate password, COPY the generated password and paste it under the "pma" part in config.inc.php (same place you change from http to cookie based phpmyadmin).
After saving the new password to config.inc php, go to phpmyadmin and save the user "pma" with the new password.

And it should work fine.

#1045 - Access denied for user 'root'@'localhost' (using password: NO)
Znote said:
Solution1: Download google chrome if you dont got it yet, in google chrome hold in the key combination in this order: CTRL + SHIFT + N. You now open a google browser without cache. Now enter phpmyadmin and see if you still have problems.

Solution2: If you still have same problem, enter C:\UniServer\home\admin\www\phpMyAdmin open the file config.inc.php with text editor. (like notepad).
Change back to auth_type = config:
PHP:
$cfg['Servers'][$i]['auth_type']       = 'config';

Then enter google chrome, hold in the key combination in this order: CTRL + SHIFT + N. You now open a google browser without cache. Now enter phpmyadmin and see if you still have problems.
 
Last edited:
The reason I haven't kept on the tutorial and made a website, is because I do not support Gesior AAC. Once Modern AAC and/or Marlex AAC comes public, I will create a how-to implement a working secured website as well. :)

Wow rlly nice, And as I know that I heared many of which dangerous proplems in Gesior .
Shit if there was NICAW STILL! :p
 
Use APC instead of eAccelerator (APC is budled with PHP6 now). Also, would have been nice with lighttpd instead, but yeye.
 
Use APC instead of eAccelerator (APC is budled with PHP6 now). Also, would have been nice with lighttpd instead, but yeye.

Gonna look at it. (APC)

lighthttpd (LightTPD - Windows) is not properly on Windows yet(If it ever will be). So I couldn't find any up to date easy install versions of it.

Feel free to help me a little out if you want. :p

But you should agree that Uniform Server > XAMPP

nginx-windows!

I heard it was insecure?
 
Last edited:
nginx-windows!

Gonna look at it. (APC)

lighthttpd (LightTPD - Windows) is not properly on Windows yet(If it ever will be). So I couldn't find any up to date easy install versions of it.

Feel free to help me a little out if you want. :p

But you should agree that Uniform Server > XAMPP
Ofcource it's better :). Anyway, last time I checked it was really easy to compile Lighttpd for Windows using Cygwin.

I heard it was insecure?
I didn't even know it existed for Windows.
 
Znote is always 0pr0 with these, awesome job bro!
 
I like it aswell.... specially the images, it makes the understanding easier :d because describing where to click and write is harder if its a text.
 
good alternative, but just give me a quick tip to install gesior (only if I make htdocs copy/paste, right?)
 
Last edited:
Status
Not open for further replies.
Back
Top