Published at Apr 27, 2014 - 21:38:38 by dixDel
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:
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so
We include SSL own configuration file:
# Secure (SSL/TLS
[...] Display full article
Published at Apr 27, 2014 - 20:02:58 by dixDel
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 in my first article.
First, install php-fpm and [...] Display full article
Published at Apr 22, 2014 - 00:22:05 by dixDel
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 notation, replacing JOIN with a comma: [...] Display full article
Published at Apr 16, 2014 - 00:19:51 by dixDel
The following command makes sed delete every lines containing the matching pattern from the file named foo. If this file is important, we make sure to back it up first!
$ sed -i '/pattern/d' /path/to/foo
The -i flag (GNU version only) edit the file in-place. For non-GNU version, we can redirect the output with >.
$ sed '/pattern/d' /path/to/foo > /path/to/foo
Published at Apr 09, 2014 - 10:38:50 by dixDel
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 need to grant file access to the database user:
[...] Display full article
Published at Apr 07, 2014 - 18:10:03 by dixDel
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:
mysql -u username -p database_name < /path/to/backup_table_name.sql
Published at Mar 28, 2014 - 18:51:48 by dixDel
There can be a few reasons for this very helpful message. In my case, MySQL's default engine on the production server was MyISAM, while being InnoDB on the development server.
MyISAM does not handle foreign keys, thus the above error. The simple fix is to switch engines:
mysql> ALTER TABLE tableName ENGINE = InnoDB;