Why can't CakePHP bake connect to MySQL running under EasyPHP on Windows Vista Ultimate?
Asked Answered
I

4

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?

Inhume answered 6/5, 2009 at 9:56 Comment(3)
I think you had a PHP installation without a compiled MySQL extension.Marseillaise
Yep, seems that EasyPHP doesn't provide the compiled MySQL for the CLI. XAMPP does that without any extra steps, just installation. Thanks anyways :)Inhume
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.Litalitany
P
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

Power answered 6/5, 2009 at 12:18 Comment(1)
Thanks, man .. it's was the silly EasyPHP! Now all's great (Y)Inhume
D
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.

Derwon answered 25/12, 2009 at 15:44 Comment(0)
Z
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.

Zoara answered 6/5, 2009 at 11:17 Comment(2)
Thx for the reply, but would you mind telling me how could I know that? I'm still new to those stuff :$ :)Inhume
EasyPHP is Windows-specific.Outrun
R
0

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

Rog answered 17/5, 2009 at 13:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.