Showing posts with label Error Status. Show all posts
Showing posts with label Error Status. Show all posts

Saturday, 20 August 2011

How to fix "Cannot load mysqli extension. Please check your PHP configuration" phpMyAdmin Error.


- Solution -
step 1:
open php.ini and search for 'extension_dir' and check whether the files and folders exist in the given path and the right version number folder.
  
extension_dir = "c:/wamp/bin/php/php<version number>/ext/"

if you have made any changes, then restart all services and check phpmyadmin, if it doesn't work try...

step 2:
open php.ini and uncomment the following lines in php.ini if any by removing the '#' at the beginning of the line.
 
extension=php_mysql.dll
extension=php_mysqli.dll

extension=php_mbstring.dll

Check phpmyadmin, it should be working now :).

Ajax Session Time Out Handling in PHP

Recently I stuck up with ajax time out issue .Yup, my webpage went weird once the session get expired, as a result i can see my login page appeared inside the result div tag.

But i want to identify the session status and it should redirect to login page.Now the following steps shed some light to tackle this ajax session timeout issue.


During Ajax request , using the browser like Firefox, the requested url can be visible through console which further can be run from the browser address bar. This can be prevent by PHP’s $_SERVER['HTTP_X_REQUESTED_WITH'] variable.

If your are using simple javascript no jQuery, Mootools or any other JavaScript API, set the ajax request header to

xmlHttp.open(“GET”,url,true); // After this set header as
xmlHttp.setRequestHeader(“X-Requested-With”, “XMLHttpRequest”);

With jQurey,Mootools no need to set this header.

With PHP set this code

define(‘IS_AJAX’, isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == ‘xmlhttprequest’);

Now in ajax call page set the code as

if(!IS_AJAX){
echo ‘ Direct Access Is not Allowed’;
exit;

}