Databases, FTP, SSH and PHP
For building and maintaining sites yourself: databases, FTP, SSH, PHP and scheduled tasks.
Databases
How do I create a database?
Control panel, MySQL Databases: a name of 6 to 20 characters, Create Database. The page lists each database with its Server (the database host), its name, which is also the username, and where to set the password. The server is MariaDB 10.11, compatible with MySQL. Each database holds up to 1 GB.
My site cannot connect to its database.
Use the Server shown on the MySQL Databases page as the database host, never "localhost": databases run on their own servers. A wrong host is the usual cause after a move.
How do I import or export a database?
With phpMyAdmin in the control panel. Export: choose the database, Export, Quick, SQL, Go. Import: Import, choose the .sql file, Go; if it fails on keys, untick "Enable foreign key checks" and try again. Large imports work better by SSH (unzip .zip or .gz files first):
mysql -h host -u user -p database < file.sql
mysqldump -h host -u user -p database > file.sqlHow do I connect from MySQL Workbench or HeidiSQL?
Control panel, Remote MySQL Access: choose the database user, enter your IP address and press Add Host. That page shows the host and port for remote connections, which differ from the normal database host. Allowing any IP address (%) is possible but not recommended.
"MySQL server has gone away", or a big database makes the site slow.
In phpMyAdmin select all tables and choose "Optimize table"; "Repair table" is in the same list. WordPress databases shrink when you remove tables of deleted plugins, old revisions and expired transients.
FTP and SFTP
FTP does not connect.
FTP is locked by default. In the control panel's FTP section, unlock it for a time or for your IP address; the FTP Details there give host, username and password. A locked FTP is the most common reason it fails.
Which settings do I use?
- Host: ftp.yourdomain.lk once your nameservers point to us; before that, the host in FTP Details.
- SFTP (encrypted, recommended): port 22, same details. Use FileZilla or WinSCP.
- Plain FTP: passive mode, ports 49152-65534.
- Your site's files are in public_html.
The largest file over FTP is 5 GB; for bigger files use SSH (SCP in WinSCP, or rsync).
SSH
How do I set up SSH?
Control panel, SSH Access (Security): add a public key (made with ssh-keygen, or PuTTYgen on Windows), or set an SSH password together with an authenticator app. The page shows the host and username. After the first setup allow up to 30 minutes. Then connect with PuTTY or Windows Terminal, or on macOS and Linux:
ssh username@host
rsync -v file.zip username@host:path
Your home path is shown in the control panel (Account Information).
Can I use sudo?
No. Using sudo ends the session and blocks SSH for the hosting; write to us to have it unblocked.
Which tools are installed?
WP-CLI (wp), Composer, Git, rsync, unzip and ImageMagick. The login message lists the PHP
versions. Run Composer with your site's PHP version, for example PHP 8.3:
/usr/bin/php83 -f /usr/bin/composer install
Composer 2 is composer2. Git also has a page in the control panel (Git Version Control), where
shown. Git hooks need a setting on our side; write to us.
"kex_exchange_identification: connection closed by remote host"
A network problem, a wrong host, or an SSH program offering old methods. Update the program and try another network; if it persists, write to us with the full output.
PHP
How do I change the PHP version?
Control panel, Change PHP Version: 5.3 to 8.5, active within a minute. For a different version in one folder or subdomain, put this at the top of that folder's .htaccess (83 means 8.3, 74 means 7.4):
AddHandler x-httpd-php83 .phpThe browser shows PHP code instead of running it.
A broken or foreign PHP line in .htaccess, often one left from cPanel such as "AddHandler application/x-httpd-ea-php56". Remove it and set the version in the control panel.
How do I raise memory_limit or upload_max_filesize?
Control panel, PHP Configuration. The defaults are 128M for memory and 128M for uploads; memory_limit goes up to 2048M, and 1024M is plenty for nearly every site. "Allowed memory size exhausted" in the error log means raise it. Other settings go into a .user.ini file in the site's folder.
PHP shows the wrong time.
Add this line to .user.ini in the site's folder:
date.timezone=Asia/ColomboWhich PHP extensions are there?
Among others mysqli, PDO (MySQL, PostgreSQL, SQLite), gd, imagick, intl, mbstring, curl, zip, soap,
sodium, OPcache, ionCube Loader (not on PHP 8.0) and SourceGuardian. The old mysql_* functions exist only on
PHP 5.3-5.6. The full list: php83 -m by SSH, or a phpinfo() file (delete it afterwards). On
WordPress hosting some functions such as exec and shell_exec can be switched off for security.
My PHP script does not send mail.
The sender address must be at a domain on the same hosting. The limits are in Email. A site with red Malware Scan findings has PHP mail switched off.
Can I run Node.js, Python or Redis?
No: Node.js (so no server-side Next.js or Remix), Python/Django, Xdebug and Redis are not available. If
you need them, write to us. A React or Vue app built as static files (npm run build) works:
upload the build or dist folder, point the document root at it and add to .htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]Scheduled tasks (cron)
My scheduled task runs old PHP or does not work.
Set it up in the control panel, Scheduled Tasks. A task that calls an address with wget runs under an old
PHP version; for current code, start it with the PHP of your site's version, for example
/usr/bin/php83-cgi. Do not start two tasks for the same job in the same minute. Scheduled tasks
are switched off while the Malware Scan has red findings. If a correct task still does not run, write to
us.
Still stuck?
Write to support (at) lunida.net in Sinhala, Tamil or English. Tell us your domain and what you see; a screenshot helps.
support (at) lunida.net