Enable InnoDb by default.

March 31, 2009

To check the current support Mysql types.

mysql> show engines;
+————+———-+—————————————————————-+
| Engine     | Support  | Comment                                                        |
+————+———-+—————————————————————-+
| MyISAM     | DEFAULT  | Default engine as of MySQL 3.23 with great performance         |
| MEMORY     | YES      | Hash based, stored in memory, useful for temporary tables      |
| InnoDB     | YES      | Supports transactions, row-level locking, and foreign keys     |
| BerkeleyDB | NO       | Supports transactions and page-level locking                   |

This implies, InnoDB has been enabled by default. You can disable this by adding the following line in my.cnf and restart mysql.

skip-innodb

Once InnoDB is enabled, you can make it the default table type by specifying the following in /etc/my.cnf:

default-table-type=innodb

Php.ini not taking the local values.

March 1, 2009

You will need to create a file called php.cgi under the public_html directory of the user. The php.cgi must contain the following code in it.

#!/bin/sh
exec /usr/local/cpanel/cgi-sys/php5 -c /home/username/php.ini

Obviously, you will need to advise the client in your response that his custom php.ini file resides in /home/username/php.ini (if he puts a php.ini in the directory he needs the custom php config working in, this will not work).

The php.cgi must have execute permissions!

Once this is done, create a .htaccess in the directory you need custom php5 configuration working with the following code in it.

Options All -Indexes
AddHandler application/x-httpd-php5 .php
Action application/x-httpd-php5 /php5.cgi

Putting this code in other .htaccess files in other directories will make php5 use /home/username/php.ini as a configuration file too.

After that you can test it by putting a phpinfo() file in that directory and accessing it via browser. It should show the path to php.ini as /home/username/php.ini

Hope you enjoy it.


Disable Core Dumps on Linux

March 1, 2009

Disable Core Dumps

To disable core dumps for all users, open /etc/security/limits.conf, enter:
# vi /etc/security/limits.conf
Make sure the following config directive exists:

* hard core 0

Save and close the file. Once a hard limit is set in /etc/security/limits.conf, the user cannot increase that limit within his own session. Add

fs.suid_dumpable = 0 to /etc/sysctl.conf file:

# echo ‘fs.suid_dumpable = 0′ >> /etc/sysctl.conf
# sysctl -p

This will make sure that core dumps can never be made by setuid programs. Finally, add the following to /etc/profile to set a soft limit to stop the creation of core dump files for all users (which is default and must be disabled):

# echo ‘ulimit -S -c 0 > /dev/null 2>&1′ >> /etc/profile