Fatal error: Call to undefined function mysql_connect() in
/opt/lampp/htdocs/cake/cake/libs/model/datasources/dbo/dbo_mysql.php on line 370
//shell
<?php
class ReportShell extends Shell
{
var $uses = array('Customer');
function main()
{
$customers = $this->Customer->find('all');
var_dump($customers);
$this->out('lol my first CakePHP shell is baked');
}
}
?>
//model
<?php
class Customer extends AppModel
{
var $name = "Customer";
var $useTable = "customer";
var $hasMany = array
('CustomerPrice',
'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',
'message' => 'A customer number should be numeric !'
)
);
/**
* 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 */
if($customer_id)
{ $response = $this->Customer->findByCustomerId($response$
if($customer_number)
{ $response = $this->Customer->findByCustomerNumber($resp$
if($customer_name)
{ $response = $this->Customer->findByCustomerName($respon$
if($customer_billing_month)
{ $response = $this->Customer->findByCustomerBillingMonth$
if($customer_start_date)
{ $response = $this->Customer->findByCustomerStartDate($r$
if($customer_end_date)
{ $response = $this->Customer->findByCustomerEndDate($res$
if($customer_email)
{ $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_',
);
views:
267answers:
3
+1
A:
The answer is that the extention for mysql in php cli was not activated or installed
Gos
2009-04-23 07:46:42
+5
A:
"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.
zombat
2009-04-23 07:53:15
+4
A:
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.
akiro
2009-04-23 10:09:46
yes probably most of the linux distro's have a differend php.ini
Gos
2009-04-27 06:58:27