Saturday, 28 April 2012

PHP Interview question 11


36) How can we get the properties (size, type, width, height) of an image using PHP image functions?
Ans:       To know the Image type use exif_imagetype () function
To know the Image size use getimagesize () function
To know the image width use imagesx () function
To know the image height use imagesy() function t

37) How can we get the browser properties using PHP?
Ans :      By using
$_SERVER['HTTP_USER_AGENT'] variable.

38) What is the maximum size of a file that can be uploaded using PHP and how can we change this?
Ans :      By default the maximum size is 2MB. and we can change the following setup at php.iniupload_max_filesize = 2M

39) How can we increase the execution time of a PHP script?
Ans :      by changing the following setup at php.ini max_execution_time = 30; Maximum execution time of each script, in seconds                

40) How can we take a backup of a MySQL table and how can we restore it. ?
Ans :      To backup: BACKUP TABLE tbl_name[,tbl_name¦] TO '/path/to/backup/directory' RESTORE TABLE tbl_name[,tbl_name¦] FROM '/path/to/backup/directory'mysqldump: Dumping Table Structure and DataUtility to dump a database or a collection of database for backup or for transferring the data to another SQL server (not necessarily a MySQL server). The dump will contain SQL statements to create the table and/or populate the table.
-t, no-create-info
Don't write table creation information (the CREATE TABLE statement).
-d, no-data
Don't write any row information for the table. This is very useful if you just want to get a dump of the structure for a table!

No comments:

Post a Comment