How can I turn off MySQL strict mode? or Solving Incorrect integer value problem with MySQL 5 strict-modeExplain the changing file permission and ownership using PHP's chmod() function. ~ Interview Questions & Answers

Wednesday, February 10, 2010

How can I turn off MySQL strict mode? or Solving Incorrect integer value problem with MySQL 5 strict-mode


This can be done in two ways...
Open your "my.ini" (my.cnf in linux) file within the MySQL installation directory, and look for the text "sql-mode".
Find:
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Replace with:
# Set the SQL mode to strict
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Or, you can run an SQL query within your database management tool, such as phpMyAdmin:
SET @global.sql_mode= '';

Friday, February 5, 2010

Explain the changing file permission and ownership using PHP's chmod() function.

Chmod() is used for changing permissions on a file.
Syntax:
Chmod(file, mode)
Mode here specifies the permissions as follows:
* The first number is always zero
* The second number specifies permissions for the owner
* The third number specifies permissions for the owner's user group
* The fourth number specifies permissions for everybody else
Possible values (to set multiple permissions, add up the following numbers)
* 1 = execute permissions
* 2 = write permissions
* 4 = read permissions
Example:
// everything for owner, read for owner's group
chmod("test.txt",0740);