Read answer< /A>
Latest Answer - Notify URL and Return URL is
used in Paypal Payment Gateway integration.............
Read answer
Latest Answer - Both the functions are used to
find the first occurrence of a string.............
Read answer
Latest Answer - Different methods to pass data
from one web page to another:............
Read answer
Test your
PHP skills - PHP (39 questions)
Test
your MySQL skills - MySQL (20 questions)
Explain how to execute a PHP script
using command line.
How can we increase the execution
time of a PHP script?
Explain the purpose of output
buffering in PHP.
Describe session in PHP.
How can we know the number of days
between two given dates using PHP?
PHP Interview - Jan 22, 2009 at 18:00 pm by Rajmeet Ghai
Explain how to execute a PHP script using command line.
PHP script using command line can be executed using SAPI (Server Application
programming Interface). Using SAPI Command Line Interface the PHP code can be
passed to execute directly
Example:
Php –r ‘print_r(get_defined_constanrs());’
From a shell, php –v will display whether the SAPI is CLI or CGI
How can we increase the execution time of a PHP script?
By default the PHP script takes 30secs to execute. This time is set in the
php.ini file. This time can be increased by modifying the max_execution_time in
seconds. The time must be changed keeping the environment of the server. This
is because modifying the execution time will affect all the sites hosted by the
server.
Explain the purpose of output buffering in PHP.
Output buffering in PHP buffers a scripts output. This buffer can be edited
before returning it to the client. Without output buffering, PHP sends data to
the web server as soon as it is ready. Output buffering "send" cookies at any
point in the script. Cookies do not have to be necessarily sent near the start
of page. Output buffers are stackable and hence sending to output is by choice.
Describe session in PHP.
When a user logs in an application, his details are usually stored in a session
variable. This information is available to all pages in one application.
Sessions in PHP work using a unique id for each visitor.
How can we know the number of days between two given dates using
PHP?
The start date and end date can be first found as shown below:
$date1= strotime($start_date);
$date2= strotime($end_date);
$date_diff = (($date1)- ($date2)) / (60*60*24)