Viewed   134 times

I have a problem with phpmyadmin on ubuntu 12.04. I have already installed apache2, php5, mysql and phpmyadmin.

The phpinfo(); script, don't show nothing about mysqli or mysql extension.

When I try start phpmyadmin this error appear:

----
**phpMyAdmin - Error**
-------
**The mysqli extension is missing. Please check your PHP configuration.**
----

In the php.ini file, I uncommented extension=mysql.so line, but doesn't work...

Anyone have another posible solution?

 Answers

2

Just restart the apache2 and mysql:

  • apache2: sudo /etc/init.d/apache2 restart

  • mysql: sudo /etc/init.d/mysql restart

then refresh your browser, enjoy phpmyadmin :)

Friday, September 30, 2022
1

To be sure you see all PHP errors, add this code on top of your script:

error_reporting(E_ALL);
ini_set('display_errors', 1);

You must correct your calls to mysqli_real_escape_string. According to the documentation, there must be two parameters, and the first parameter must be a MySQL link. In your case that link would be $mysqli.

Also, replace:

if($row==1){

with:

if($result->num_row==1){

You are misunderstanding what $result->num_rows is: it contains the TOTAL number of rows returned by the query whose result is stored in $result. So, it is useless to check the value of $result->num_rows inside the loop where you retrieve all records returned by the query.

I removed the constant MYSQLI_USE_RESULT from your query() because the documentation for mysqli_query says:
If you use MYSQLI_USE_RESULT all subsequent calls will return error Commands out of sync unless you call mysqli_free_result().

New code:

<?php
    $mysqli = new mysqli('localhost', 'root', 'password', 'aiesec');

    /* check connection */
    if (mysqli_connect_errno()) {
        printf("Connect failed: %sn", mysqli_connect_error());
        exit();
    }

    // cleanup POST variables
    $myusername = mysqli_real_escape_string($mysqli, stripslashes(trim($_POST['myusername'])));
    $mypassword = mysqli_real_escape_string($mysqli, stripslashes(trim($_POST['mypassword'])));

    // If result matched $myusername and $mypassword, table row must be 1 row
    $sql = "SELECT * FROM members WHERE username='$myusername' and password='$mypassword'"; 
    $result = mysqli->query($sql);
     if($mysqli->errno<>0)
        die("Errormessage: %sn", $mysqli->error);
    echo $result->num_rows;
    if($result->num_rows==1){
        echo "correct username and pass";
        // Register $myusername, $mypassword and redirect to file "login_success.php"
       // session_register("myusername");
        //session_register("mypassword");
        //header("location:login_success.php");
    }
    else {
        echo "Wrong Username or Password";
    }
    mysqli_close();     
?>
Monday, August 1, 2022
 
zac
 
zac
2

You can install the fastcgi mod and apache2 from here, verified that it works on my end. https://launchpad.net/~ondrej/+archive/apache2?field.series_filter=precise

Saturday, October 29, 2022
 
3

After restarting your web service, check PHP info:

phpinfo();

Does the extension appear there? If so, it loaded correctly. If not, you are likely missing the DLL, or have the wrong extension path.

Look for something like this:

Sunday, July 31, 2022
 
1

I feel reasonably confident that there's nothing wrong with your MySQL installation, which is why repairing the tables shows no problems found. Those are artifacts of the real problem:

You simply don't have enough memory on your machine to do everything you're trying to do.

From your configuration:

key_buffer              = 384M

Between that and the de for innodb_buffer_pool_size of 128M, that's 512M that has to be available all of the time and if it can't be allocated at startup or restart of MySQL, it's not going to start.

131210 13:06:25 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
131210 13:06:25 InnoDB: Completed initialization of buffer pool
131210 13:06:25 InnoDB: Fatal error: cannot allocate memory for the buffer pool
131210 13:06:25 [ERROR] Plugin 'InnoDB' init function returned error.

This isn't a MySQL crash -- it's MySQL failing to start -- or restart -- because there aren't 128MB of free memory available to allocate.

Error 12 is "Out of Memory" -- system memory.

The other messages in your error log are all essentially side-effects.

I suspect that also in your log you will see this:

YYMMDD HH:MM:SS mysqld_safe Number of processes running now: 0

If that error message is not immediately preceded by a crash dump ("MySQL caught signal xx" followed by a stack trace and a lot of debugging information) then it's not likely to be MySQL crashing -- it's MySQL being killed by the kernel to try to keep the whole system from crashing due to a crisis situation related to available memory. Apache's forking model is notorious for this -- as your site becomes busy, Apache spawns more children, each of which has an appetite for memory.

You will probably find evidence of this in your syslogs.

Xxx xx xx:xx:xx [machine name] kernel: Out of memory: Killed process xxxx, UID xx, (mysqld).

The options are to add more memory, or reduce MySQL's memory footprint via configuration, or reduce the number of children Apache can spawn, or eliminate other processes from the system, or separate the database and web server onto different machines, or add more swap -- but a MySQL machine that is swapping is not going to perform optimally.

For similar scenarios, see also:

  • Intermittent MySQL crashes with error “Fatal error: cannot allocate memory for the buffer pool”
  • MySQL InnoDB Crash Post-Mortem
Thursday, October 20, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :