Category: PHP

How to prevent web browser to image caching.

June 16, 2010 | Filed Under PHP | Leave a Comment

The simple way to prevent image caching is to append time stamp with the name on image.

Ex-<img src=’image.jpg?<?php echo time() ?>’ />

In the above code browser understand a new image at every call. But HTML parser understands “image.jpg” for every call.

Article written by admin

How we can prevent Web browsers caching?

June 15, 2010 | Filed Under PHP | Leave a Comment
Using HTML meta tags: we can prevent Web browsers caching.
<meta http-equiv="Expires" content="Sun, 20 Fed 2000 01:11:11 GMT"
/>
<meta http-equiv="Pragma" content="no-cache" />
Here Meta tag tells the browser, cached copy of the page in back date.That means   browser should never cache the page.
But some browser does not support this approach .If you are working with php and include the header that has Meta definition.
For this case, use php Header function to produce the two meta tags above
<?php
header('Expires: Sun, 20 Fed 2000 01:11:11 GMT');
header('Pragma: no-cache');
?>
Or use
<?php
header('Expires: Sun, 20 Fed 2000 01:11:11 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
?>

In this case visitor will always see the latest contents.

Article written by admin

How can we submit a form without a submit button?

June 14, 2010 | Filed Under PHP | Leave a Comment
<script>
function doSubmit()
{
  var frm = window.document.frmName;
  frm.action="path to php file";
  frm.method = post;
  frm.submit();
}
</script>
Article written by urooj

Where to change in php.ini file for file uploading?

June 14, 2010 | Filed Under PHP | Leave a Comment
You can call the phpinfo() function to find the location of
your php.ini file, it will also tell you the current values
for the following settings that we need to modify

1.file_uploads
2.upload_max_filesize
3.max_input_time
4.memory_limit
5.max_execution_time
6.post_max_size
Article written by urooj

What is the default session time in PHP and how can I change it?

June 14, 2010 | Filed Under PHP | Leave a Comment
Default session time in PHP is 1440 seconds. if we want to
change the session time in php, then we have to change in
php.ini.
Article written by urooj

How can we increase Memory size in php during run time?

June 9, 2010 | Filed Under PHP | Leave a Comment

using ini_set(’memory_limit’,'15M’); // now 15M space is set during run time.

Article written by admin

How can we change the value of php.ini during runtime?

June 9, 2010 | Filed Under PHP | Leave a Comment

Using string ini_set ( string $varname , string $newvalue ).
you can change

Article written by admin

How to increase Execution Time Limit in php Using ini_set()

June 9, 2010 | Filed Under PHP | Leave a Comment

To   increase the execution time for any php script simple use below code.

ini_set(‘max_execution_time’, 240); //240seconds = 4 minutes

Article written by admin

Q What are the two important changes in new versions of PHP that affect old code are ?

June 1, 2010 | Filed Under PHP | Leave a Comment

Ans: Following two of the most important recent changes that affect old code are:
The deprecation of the old $HTTP_*_VARS arrays (which need to be indicated as global when used inside a function or method). The following superglobal arrays were introduced in PHP » 4.1.0. They are: $_GET, $_POST, $_COOKIE, $_SERVER, $_FILES, $_ENV, $_REQUEST, and $_SESSION. The older $HTTP_*_VARS arrays, such as $HTTP_POST_VARS, still exist as they have since PHP 3. As of PHP 5.0.0, the long PHP predefined variable arrays may be disabled with the register_long_arrays directive.

Article written by admin

Q How the method of our form is POST ?

June 1, 2010 | Filed Under PHP | Leave a Comment

Ans: If we used the method GET then our form information would live in the $_GET superglobal instead.
You may also use the $_REQUEST superglobal. if you do not care about the source of your request data. It contains the merged information of GET, POST and COOKIE data.

Article written by admin

© PHPInterviewQuestion.com 2009 - 2010

eXTReMe Tracker