We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

MySQL connection problem



  • I have successfully installed mysql,php and phpmyadmin. Although I have few problems. I found simple solution for creating connections on mysql database through php. Here is the code I used for connection:

    $servername = "127.0.0.1";
    $username = "myusername";
    $password = "mypassword";
    try {
        $conn = new PDO("mysql:host=$servername;dbname=test", $username, $password);
        // set the PDO error mode to exception
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        echo "Connected successfully"; 
        }
    catch(PDOException $e)
        {
        echo "Connection failed: " . $e->getMessage();
        }
    

    The error I'm getting is "Connection failed: could not find driver". Anyone has any idea what I'm doing wrong?



  • @Milan-Vuckovic You need to have the mysql driver for php. Try the following:

    opkg update
    opkg install php5-mysql
    


  • It says that it's unknown package.

       Unknown package 'php5-mysql'.
    Collected errors:
     * opkg_install_cmd: Cannot install package php5-mysql.
    


  • @Milan-Vuckovic Don't know whether this is correct or not but I am wondering if the package name is not actually php5-mysql but rather one of the following (which I found by doing opkg list on names containing php5 and mysqlšŸ˜ž

    • php5-mod-mysql : php5-mod-mysql - 5.6.8-1 - MySQL shared module
    • php5-mod-mysqli : php5-mod-mysqli - 5.6.8-1 - MySQL Improved Extension shared module
    • php5-mod-pdo-mysql : php5-mod-pdo-mysql - 5.6.8-1 - PDO driver for MySQL shared module


  • @Kit-Bishop That last package was not installed. Thank you for help.



  • It seems the PHP5 is no longer supported: just use php7 instead where you see php5 in the previous posts, and it should work.
    I found it using the command "opkg list php*" to see what was there (without the php* can be used to find ALL packages...


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.