How can we increase the execution time of a php script?
Correct Answer
By the use of void set_time_limit(int seconds) Set the number of seconds a script is allowed to run If this is reached, the script returns a fatal error The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the phpini If seconds is set to zero, no time limit is imposed When called, set_time_limit() restarts the timeout counter from zero In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out
Technology problems
Search Results
1. What is the difference between PHP and JavaScript?
Correct Answer: The difference lies with the execution of the languages PHP is server side scripting language, which means that it can?t interact directly with the user Whereas, JavaScript is client side scripting language, that is used to interact directly with the user
2. Why many companies are switching their current business language to PHP? Where PHP basically used?
Correct Answer: PHP is rapidly gaining the popularity and many companies are switching their current language for this language PHP is a server side scripting language PHP executes the instructions on the server itself Server is a computer where the web site is located PHP is used to create dynamic pages and provides faster execution of the instructions
Correct Answer: MIME - Multi-purpose Internet Mail Extensions MIME types represents a standard way of classifying file types over Internet Web servers and browsers have a list of MIME types, which facilitates files transfer of the same type in the same way, irrespective of operating system they are working in A MIME type has two parts: a type and a subtype They are separated by a slash (/) MIME type for Microsoft Word files is application and the subtype is msword, ie application/msword
Correct Answer: Notices, Warnings and Fatal errors are the types of errors in PHP Notices: Notices represents non-critical errors, ie accessing a variable that has not yet been defined By default, such errors are not displayed to the user at all but whenever required, you can change this default behavior Warnings: Warnings are more serious errors but they do not result in script termination ie calling include() a file which does not exist By default, these errors are displayed to the user Fatal errors: Fatal errors are critical errors ie calling a non-existent function or class These errors cause the immediate termination of the script
Correct Answer: $message is a variable with a fixed name $$message is a variable whose name is stored in $message If $message contains "var", $$message is the same as $var
Correct Answer: Super global arrays are the built in arrays that can be used anywhere They are also called as auto-global as they can be used inside a function as well The arrays with the longs names such as $HTTP_SERVER_VARS, must be made global before they can be used in an array This $HTTP_SERVER_VARS check your phpini setting for long arrays
Correct Answer: $_SERVER and $_ENV arrays contain different information The information depends on the server and operating system being used Most of the information can be seen of an array for a particular server and operating system The syntax is as follows: foreach($_SERVER as $key =>$value) { echo ?Key=$key, Value=$value\n?; }
8. What is the difference between $argv and $argc? Give example?
Correct Answer: To pass the information into the script from outside, help can be taken from the PHP CLI (Command line interface) method Suppose addition of two numbers has to be passed to PHP then it can be passed like this on the command line: php addphp 2 3 Here the script name is addphp, and 2 and 3 are the numbers that has to be added by the script These numbers are available inside the script in an array called $argv This array contains all the information on the command line; the statement is stored as follows: $argv[0]=addphp $argv[1]=2 $argv[2]=3 So, $argv always contains at least one element ? the script name Then, in your script, you can use the following statements: $sum = $argv[1] + $argv[2]; echo $sum; $argc is a variable that stores the numbers of elements in $argv $argc is equal to at least 1, which is saved for the name of the script Example is $argc=3 using the above statements
Correct Answer: Permissions in PHP are very similar to UNIX Each file has three types of permissions ? Read, write and execute Permissions can be changed using the change mode or CHMOD command CHMOD is followed by 3 digit number specifying the permission type CHMOD 777 is for Read, Write and execute Unnecessary permissions can be stripped off using UNMASK command Unmask (777);
Correct Answer: To access the global data which is originating externally, the super globals are used The superglobals are available as arrays These superglobals represents the data from URLs, HTML forms, cookies, sessions and also the web server For this purpose, $HTTP_GET_VARS, $HTTP_POST_VARS are used The super globals are pretty good enough to be used in functions The following are the list of super globals $_GET, $_POST, $_COOKIE;$_REQUEST, $_SERVER, $_SESSION, $_ENV, $_FILE Another PHP Superglobal, called $GLOBALS; is available for persisting every variable with global scope