this guide is abit outdated…

If you need XDebug + Eclipse look here (allows step-debugging of your php code very very nice 🙂 . (slightly more complicated setup)

lighttpd is “just as good” as apache2 – except – it does not support .htaccess. 🙁

But besides from that – it runs fast – and is easy to configure. just what we want 😀

WordPress runs flawless with lighttpd – while some very very specific software like “Magento Shop” is stuck to Apache2.

Another problem that needs to be addressed: unfortunately – from version to version – this setup process WILL change.

So you really need to check if the howto matches your version of Debian (or any other Linux).

IMHO there should be an easy to install meta-package that allows admins to make that process more easy and standardized.

uname -a; # tested on
Linux debian8 3.16.0-4-686-pae #1 SMP Debian 3.16.43-2 (2017-04-30) i686 GNU/Linux

su - root
apt update
# install webserver lighttpd

# it will install additional packages also database mariadb
# (mariadb is the successor to mysql)
apt install lighttpd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libfam0 libmariadb3 lighttpd-modules-ldap lighttpd-modules-mysql mariadb-common mysql-common spawn-fcgi
Suggested packages:
  fam rrdtool php-cgi apache2-utils lighttpd-doc
The following NEW packages will be installed:
  libfam0 libmariadb3 lighttpd lighttpd-modules-ldap lighttpd-modules-mysql mariadb-common mysql-common spawn-fcgi
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 610 kB of archives.
After this operation, 2,110 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
...
Fetched 610 kB in 0s (3,102 kB/s)                 
Selecting previously unselected package libfam0:amd64.
(Reading database ... 29625 files and directories currently installed.)
Preparing to unpack .../0-libfam0_2.7.0-17.3_amd64.deb ...
Unpacking libfam0:amd64 (2.7.0-17.3) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../1-mysql-common_5.8+1.0.5_all.deb ...
Unpacking mysql-common (5.8+1.0.5) ...
Selecting previously unselected package mariadb-common.
Preparing to unpack .../2-mariadb-common_1%3a10.3.29-0+deb10u1_all.deb ...
Unpacking mariadb-common (1:10.3.29-0+deb10u1) ...
Selecting previously unselected package libmariadb3:amd64.
Preparing to unpack .../3-libmariadb3_1%3a10.3.29-0+deb10u1_amd64.deb ...
Unpacking libmariadb3:amd64 (1:10.3.29-0+deb10u1) ...
Selecting previously unselected package lighttpd.
Preparing to unpack .../4-lighttpd_1.4.53-4+deb10u1_amd64.deb ...
Unpacking lighttpd (1.4.53-4+deb10u1) ...
Selecting previously unselected package lighttpd-modules-ldap.
Preparing to unpack .../5-lighttpd-modules-ldap_1.4.53-4+deb10u1_amd64.deb ...
Unpacking lighttpd-modules-ldap (1.4.53-4+deb10u1) ...
Selecting previously unselected package lighttpd-modules-mysql.
Preparing to unpack .../6-lighttpd-modules-mysql_1.4.53-4+deb10u1_amd64.deb ...
Unpacking lighttpd-modules-mysql (1.4.53-4+deb10u1) ...
Selecting previously unselected package spawn-fcgi.
Preparing to unpack .../7-spawn-fcgi_1.6.4-2_amd64.deb ...
Unpacking spawn-fcgi (1.6.4-2) ...
Setting up mysql-common (5.8+1.0.5) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up mariadb-common (1:10.3.29-0+deb10u1) ...
update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up libmariadb3:amd64 (1:10.3.29-0+deb10u1) ...
Setting up libfam0:amd64 (2.7.0-17.3) ...
Setting up spawn-fcgi (1.6.4-2) ...
Setting up lighttpd (1.4.53-4+deb10u1) ...
Enabling unconfigured: ok
Run "service lighttpd force-reload" to enable changes
Created symlink /etc/systemd/system/multi-user.target.wants/lighttpd.service → /lib/systemd/system/lighttpd.service.
Setting up lighttpd-modules-ldap (1.4.53-4+deb10u1) ...
Setting up lighttpd-modules-mysql (1.4.53-4+deb10u1) ...
Processing triggers for systemd (241-7~deb10u8) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10) ...


# immediate result in browser

# change root pwd and basic setup of database
mysql_secure_installation

# optional:
# a nice php based mysql GUI
# unless less software is better security
apt-get install phpmyadmin;


# it will ask you for the root-password of mysql

if you get those errors don’t give up YET

# simply run the same setup command AGAIN.
# old debian:
apt-get install lighttpd php5-cgi mysql-server mysql-client phpmyadmin php5-mysql php5-gd php5-dev php-pear;

# and it should go away

php5-dev php-pear; # optional stuff

# you should now have a fully functional phpmyadmin

# which is cool – because it proofs php is working as well 😀

echo “<?php phpinfo();” >> /var/www/html/info.php; # create php-test file

CONGRATULATIONS!

You have a fully functional webserver! 🙂

you can test mysql-access like this:

Help:

MySQL actually has a in-build help 😀

[cc lang=”bash” escaped=”true” width=”600″]

mysql> help;

For information about MySQL products and services, visit:
http://www.mysql.com/
For developer information, including the MySQL Reference Manual, visit:
http://dev.mysql.com/
To buy MySQL Enterprise support, training, or other products, visit:
https://shop.mysql.com/

List of all MySQL commands:
Note that all text commands must be first on line and end with ‘;’
? (\?) Synonym for `help’.
clear (\c) Clear the current input statement.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit (\e) Edit command with $EDITOR.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
nopager (\n) Disable pager, print to stdout.
notee (\t) Don’t write into outfile.
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
system (\!) Execute a system shell command.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don’t show warnings after every statement.

For server side help, type ‘help contents’

mysql> help contents;
You asked for help about help category: “Contents”
For more information, type ‘help ‘, where is one of the following
categories:
Account Management
Administration
Compound Statements
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Help Metadata
Language Structure
Plugins
Procedures
Storage Engines
Table Maintenance
Transactions
User-Defined Functions
Utility

mysql> help data types;
You asked for help about help category: “Data Types”
For more information, type ‘help ‘, where is one of the following
topics:
AUTO_INCREMENT
BIGINT
BINARY
BIT
BLOB
BLOB DATA TYPE
BOOLEAN
CHAR
CHAR BYTE
DATE
DATETIME
DEC
DECIMAL
DOUBLE
DOUBLE PRECISION
ENUM
FLOAT
INT
INTEGER
LONGBLOB
LONGTEXT
MEDIUMBLOB
MEDIUMINT
MEDIUMTEXT
SET DATA TYPE
SMALLINT
TEXT
TIME
TIMESTAMP
TINYBLOB
TINYINT
TINYTEXT
VARBINARY
VARCHAR
YEAR DATA TYPE

help varchar
Name: ‘VARCHAR’
Description:
[NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE
collation_name]

A variable-length string. M represents the maximum column length in
characters. The range of M is 0 to 65,535. The effective maximum length
of a VARCHAR is subject to the maximum row size (65,535 bytes, which is
shared among all columns) and the character set used. For example, utf8
characters can require up to three bytes per character, so a VARCHAR
column that uses the utf8 character set can be declared to be a maximum
of 21,844 characters. See
http://dev.mysql.com/doc/refman/5.5/en/column-count-limit.html.

MySQL stores VARCHAR values as a 1-byte or 2-byte length prefix plus
data. The length prefix indicates the number of bytes in the value. A
VARCHAR column uses one length byte if values require no more than 255
bytes, two length bytes if values may require more than 255 bytes.

*Note*:

MySQL follows the standard SQL specification, and does not remove
trailing spaces from VARCHAR values.

VARCHAR is shorthand for CHARACTER VARYING. NATIONAL VARCHAR is the
standard SQL way to define that a VARCHAR column should use some
predefined character set. MySQL uses utf8 as this predefined character
set. http://dev.mysql.com/doc/refman/5.5/en/charset-national.html.
NVARCHAR is shorthand for NATIONAL VARCHAR.

URL: http://dev.mysql.com/doc/refman/5.5/en/string-type-overview.html

[/cc]

 

Links:

LAMP with Apache2 – https://www.linode.com/docs/web-servers/lamp/lamp-on-debian-8-jessie

Alternatives to PHP:

If you think PHP is too slow… (it is very very good and fast for coding up a prototype)

Google “Go” – not a scripting language – will need compilation (meta-code, bytecode?) – YES it is VERY fast 😀 – https://www.reddit.com/r/golang/comments/3wfnru/switching_from_php_to_go/

While PHP is developed further in Israel, will those Google compilers be 100% Free Software? Who knows.

Alternatives to MySQL:

“So when are you required to buy a commercial license? It’s very simple: when you want to do something with MySQL that the GPL doesn’t permit.” (src)

HINT: For MySQL or any databse you will need massive amounts of RAM.

“total RAM of your database server. If it is like most then 16 GB RAM is a minimum these days. 256 GB is not out of reach. Your server probably runs out of available slots in its default-configured Netfilter firewall before it runs out of RAM.” (src)

mysql create new table - different storage engines - InnoDB MyISAM MEMORY Blackhole

mysql create new table – different storage engines – InnoDB MyISAM MEMORY Blackhole

from the developers of MySQL – untested! – https://mariadb.com/

https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-features/

src: https://mariadb.com/resources/blog/mariadb-53-optimizer-benchmark

admin