1

I have CakePHP (cake_1.2.2.8120) and EasyPHP (3.0) installed on Windows Vista Ultimate. I followed the "baking" tutorials online and successfully set the database connection with the "cake bake" command from the CLI.

I baked the controller for my "Users" table using the "php cake.php bake controller Users" command - worked fine. However, when I tried baking the view similarly, I got this message:

Fatal error: Call to undefined function mysql_connect() in C:\Web\EasyPHP

\www\cake\cake\libs\model\datasources\dbo\dbo_mysql.php on line 374'

Also, the MySQL module is enabled for PHP on the phpMyAdmin page (web), but I can't find it in the CLI (using "php -m" from the command line) even though I've uncommented the "extension=php_mysql.dll" line in the php.ini file.

How can I fix this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
AlaaShaker
  • 203
  • 4
  • 11
  • I think you had a PHP installation without a compiled MySQL extension. – powtac May 20 '09 at 13:53
  • Yep, seems that EasyPHP doesn't provide the compiled MySQL for the CLI. XAMPP does that without any extra steps, just installation. Thanks anyways :) – AlaaShaker May 22 '09 at 09:14
  • 1
    I think that the correct answer is not the one that points to change your software, but the one that points why there is the problem, ie, the answer from @andrej. That is the solution to the problem. In common PHP usage, there is a php.ini for Apache (web usage) and another one for the CLI (command line interface). So EasyPHP has the Apache one, but not the one for CLI. You must make a copy from the php.ini in the apache folder to the php folder for use in CLI. Thanks Andrej. – Alejandro García Iglesias Sep 04 '11 at 04:24

4 Answers4

5

Grab XAMPP which has Apache with the MySQL and PHP modules setup and working together, as well at the MySQL and command-line versions. It just unzips to any directory, so it won't mess up any other Apache installs you have. Just be careful of any port conflicts between the different installations.

Download XAMPP

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ryan953
  • 688
  • 4
  • 11
4

The root cause of the problem is that in EasyPHP 5.3 there isn't any php.ini file in the php folder.

Copy php.ini from EasyPHP5.3\apache to EasyPHP5.3\php to solve this nasty issue.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
andrej
  • 4,518
  • 2
  • 39
  • 39
0

I don't know EasyPHP, but it seems to be Apache-based. Check if you're using a Apache-module for the MySQL connection, as this will not work in CLI.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ickmund
  • 631
  • 1
  • 5
  • 9
0

Copy the apache/php.ini file to php/php.ini.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131