问题
I CakePHP (cake_1.2.2.8120) and EasyPHP (3.0) installed on Windows Vista Ultimate. I followed the "baking" tutorials online, 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.
Any clues?
回答1:
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.
http://www.apachefriends.org/en/xampp-windows.html
回答2:
The root cause of problem is that in EasyPHP 5.3 there is no php.ini
file in php folder. Copy php.ini
from EasyPHP5.3\apache
to EasyPHP5.3\php
to solve this nasty issue.
回答3:
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.
回答4:
copy the apache/php.ini to php/php.ini.
来源:https://stackoverflow.com/questions/828899/why-cant-cakephp-bake-connect-to-mysql-running-under-easyphp-on-windows-vista-u