Programming

33 articles

Apache: enable HTTPS

To enable HTTP Secure (HTTPS) on Apache, we first enable the modules called mod_ssl and mod_socache_shmcb in the main Apache configuration file, located at /etc/httpd/conf/httpd.conf: We include SSL own configuration file: In this file, we also set a document root (or keep the default path…

Upgrade Apache to 2.4 from 2.2 on Arch Linux, using PHP-FPM

Since the first article, more than six weeks ago, Apache has been updated to version 2.4.9 which allows for a simpler configuration with php-fpm, mod_proxy_fcgi and mod_proxy_handler. The following setup does not use mod_php, which requires mod_mpm_prefork and ProxyPassMatch directives as shown…

MariaDB / MySQL: generate a row number

There is currently no built-in method to return row numbers. The solution is to use a variable which is incremented in each row, like this: @currentRow := @currentRow + 1 AS rowNumber We can use a JOIN statement to initialise the variable without SET: JOIN (SELECT @currentRow := 0) row Another…

MariaDB / MySQL: export or backup data to a CSV file

It seems there are several ways to do this. Here is one, using the mysql prompt. I used mysql root account because my usual user has not enough permissions to write files (ERROR 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES)), even after a chmod 777: UPDATE: We…

MariaDB / MySQL: backup and restore a specific table

We just have to specify the name of the table we want to backup in the usual mysqldump command: $ mysqldump -h hostname -u username -p database_name table_name > backup_table_name.sql Then, to restore it: Source