server.cfg, resources, and dependencies
server.cfg is the startup script for your city. It names the server, sets the port, holds your secrets, and decides the order every resource loads. FXServer reads it top to bottom, so a script that needs ox_lib or oxmysql only works if those are ensured above it. In this lesson you read a real config, then build two tiny resources that prove order matters without touching a single production script.
Build it
Open server.cfg and find the ensure block
Open your server folder in VS Code (right-click the folder, Open with Code), then open server.cfg. Scroll until you find the run of lines that start with ensure. That block is the load order. A typical 2026 config looks like this:
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_hostname "My ESX Server"
sv_maxclients 48
# Pin the game build. Use a current build from the live artifacts list,
# never a stale number copied from an old guide.
sv_enforceGameBuild <current-build>
set mysql_connection_string "mysql://root:[email protected]/fivem?charset=utf8mb4"
set mysql_slow_query_warning 150
sv_licenseKey "PASTE_YOUR_CFX_PORTAL_KEY_HERE"
ensure oxmysql
ensure ox_lib
ensure es_extended
ensure ox_inventory
ensure ox_targetKnow what the important lines do
Three of those lines hold the keys to the whole server:
sv_licenseKeyis your Cfx.re Portal key. Get it free atportal.cfx.re(this is the current portal; older guides call it Keymaster). It is required even for a local test server.
If something went wrong
| Symptom | Fix |
|---|---|
Couldn't find resource qu_dep_provider | The folder name and the ensure name must match exactly. Check for a typo or a wrapping zip folder, the resource folder must hold fxmanifest.lua directly. |
provider MISSING when you expected found | The consumer was ensured above the provider. Put ensure qu_dep_provider first, save, then restart the provider before the consumer. |
No such export Ping | The provider failed to start or has a typo in exports('Ping', ...). Restart qu_dep_provider and read the line above the error in the Live Console. |
Access denied for user / Unknown database 'fivem' | Your mysql_connection_string is wrong or the database does not exist yet. Fix the connection string and create the database before ensuring oxmysql-dependent scripts. |
The command is not recognized | Type server commands like restart in the txAdmin Live Console, not in the in-game F8 client console. |
What you can do now
- Read server.cfg top to bottom and explain what every important line does, including the two that hold secrets.
- Order an ensure block as a dependency map: oxmysql, then ox_lib, then framework, then systems, then your scripts.
- Build a throwaway provider and consumer to prove ensure order without risking a live server.
- Open any script's fxmanifest.lua, read its dependencies and shared_script lines, and place it correctly in server.cfg by inspection alone.