Take the 2-minute tour ×
Fatal error: Call to undefined function mysql_connect() in
/opt/lampp/htdocs/cake/cake/libs/model/datasources/dbo/dbo_mysql.php on line 370


class ReportShell extends Shell
    var $uses = array('Customer');
    function main()
            $customers = $this->Customer->find('all');
            $this->out('lol my first CakePHP shell is baked');



class Customer extends AppModel
    var $name = "Customer";
    var $useTable = "customer";
    var $hasMany = array
     'Order' => array('foreignKey' => 'customer_id'));

    // Validation settings
    var $validate = array(
            'customer_id' => array(
                    'rule' => 'numeric',
                    'message' => 'A customer ID should be numeric !'
            'customer_number' => array(
                    'rule' => 'numeric',
                    'message' => 'A customer number should be numeric !'
            'customer_name' => array(
                    'rule' => 'notEmpty',

     * Function to retrieve Customer data
     * @param string $response_type - CakePHP find() type
     * @param array $response_setting - CakePHP find() parameter array (set$
     * @param int $customer_id - Find customer by customer ID
     * @param int $customer_number - Find customer by customer number
     * @param string $customer_name - Find customer by customer name
     * @param int $customer_billing_month - Find customer by customer billi$
     * @param int $customer_start_date - Find customer by start date
     * @param int $customer_end_date - Find customer by end date
     * @param string $customer_email - Find customer by customer e-mail
    function FjmCustomerGetCustomer($response_type, $response_setting = arr$

            /* Conditions: Find Customer by customer data */
            {       $response = $this->Customer->findByCustomerId($response$
            {       $response = $this->Customer->findByCustomerNumber($resp$
            {       $response = $this->Customer->findByCustomerName($respon$
            {       $response = $this->Customer->findByCustomerBillingMonth$
            {       $response = $this->Customer->findByCustomerStartDate($r$
            {       $response = $this->Customer->findByCustomerEndDate($res$
            {       $response = $this->Customer->findByCustomerEmail($respo$

            if(!$customer_id || !$customer_number || !$customer_name || !$c$
            {       $response = $this->Customer->find('all', $response_sett$

            return $response;

    /* FjmCustomerGetCustomerByProduct
     * FjmCustomerGetCustomerByOrder
     * FjmCustomerGetCustomerByBill
     * FjmCustomerGetCustomerByHandle


//database config php
    var $default = array(
            'driver' => 'mysql',
            'persistent' => false,
            'host' => 'localhost',
            'login' => 'root',
            'password' => 'pwd',
            'database' => 'fjm_pps',
            'prefix' => 'fjm_',
share|improve this question

3 Answers 3

"Fatal error: Call to undefined function mysql_connect()" means that you don't have the MySQL libraries included in your PHP installation.

Check your php.ini and be sure that the mysql extension is activated. The "extension=mysql.so" (or "extension=php_mysql.dll") needs to be uncommented.

Google around for help on getting MySQL libraries included into your PHP install.

share|improve this answer

Also note that on some installations (debian comes mind), if not all, cli-php and apache-php have separate php.ini:s. So having mysql enabled in one doesnt necessarily help with the other. Use phpinfo() to find out where it is looking for php.ini from.

share|improve this answer
yes probably most of the linux distro's have a differend php.ini –  Jan-Willem Hoekman Apr 27 '09 at 6:58

The answer is that the extention for mysql in php cli was not activated or installed

share|improve this answer

Your Answer


