Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Error - Call to undefined function
  • Hi, I'm french and I discover FuelPHP. My config: WINDOWS
    version: 7 UWAMP
    version: 2.1 APACHE
    version: 2.2.17 (Win32)
    virtualhost:
    <VirtualHost *:80>
    DocumentRoot "F:/UwAmp/www/fuelphp-demo/public/"
    ServerName "fuelphp-demo.local"
    </VirtualHost> PHP
    version 5.3.5
    Path: F:\UwAmp\bin\php\php-5.3.5 MySQL
    version 5.5.9
    port: 3306 I downloaded and installed FuelPHP. I followed the following tutorial:
    http://www.novius-labs.com/tutoriel-creation-projet-avec-fuelphp,35.html
    DATABASE CONFIGURATION
    ''''''''''''''''''''''
    F:\UwAmp\www\fuelphp-demo\fuel\app\config\db.php :
    <?php
    return array(
    'active' => 'default', /**
    * Base config, just need to set the DSN, username and password in env. config.
    */
    'default' => array(
    'type' => 'mysql',
    'connection' => array(
    'persistent' => false,
    ),
    'identifier' => '`',
    'table_prefix' => '',
    'charset' => 'utf8',
    'caching' => false,
    'profiling' => false,
    ), 'redis' => array(
    'default' => array(
    'hostname' => '127.0.0.1',
    'port' => 3306,
    )
    ), );
    F:\UwAmp\www\fuelphp-demo\fuel\app\config\development\db.php
    <?php
    return array(
    'default' => array(
    'connection' => array(
    'hostname' => 'localhost',
    'database' => 'fuelphp_agenda',
    'username' => 'root',
    'password' => 'myPassword',
    ),
    ),
    ); GENERATION OF CODE BY SCAFFOLD
    ''''''''''''''''''''''''''''''
    php oil generate scaffold/crud notes titre:string description:text
    Creating migration: F:\UwAmp\www\fuelphp-demo\fuel\app\migrations/001_create_notes.php
    Creating model: F:\UwAmp\www\fuelphp-demo\fuel\app\classes/model/note.php
    Creating controller: F:\UwAmp\www\fuelphp-demo\fuel\app\classes/controller/notes.php
    Creating view: F:\UwAmp\www\fuelphp-demo\fuel\app\views/notes/index.php
    Creating view: F:\UwAmp\www\fuelphp-demo\fuel\app\views/notes/view.php
    Creating view: F:\UwAmp\www\fuelphp-demo\fuel\app\views/notes/create.php
    Creating view: F:\UwAmp\www\fuelphp-demo\fuel\app\views/notes/edit.php
    Creating view: F:\UwAmp\www\fuelphp-demo\fuel\app\views/notes/_form.php
    Creating view: F:\UwAmp\www\fuelphp-demo\fuel\app\views/template.php php oil refine migrate
    Error - Call to undefined function Fuel\Core\mysql_connect() in COREPATH/classes/database/mysql/connection.php on line 96 Sorry for my poor english. Thanks in advance, Richard
  • Assuming that your php installation does work for your websites (i.e. you do have a mysql connection there), the most common cause is that the CLI version of PHP uses a different php.ini, or you have multiple PHP installations and oil uses the wrong one. We see this with MAMP on Mac as well.
  • My platform Apache is functioning properly. I use it for other development sites, without any problems.
  • So check which php-cli binary is used when you use oil, and check if that binary is the same version and uses the same php.ini as apache does. Because the message is very clear: the mysql extension hasn't been loaded. I'm not familiar with Windows so I can't be more specific, sorry.
  • php-cli uses the php.ini which is in windows folder (C:\windows). php -c [php.ini path] arg1 arg2 arg3 ... Thanks
  • and is that the same one as you apache install is using? if you do 'php -m', does it list the mysql and mysqli modules? And PDO if you want to use the pdo drivers?
  • I used 'Loaded Configuration File' in phpinfo(); F:\UwAmp\www\fuelphp-demo>php -m
    [PHP Modules]
    bcmath
    calendar
    com_dotnet
    Core
    ctype
    date
    dom
    ereg
    filter
    ftp
    hash
    iconv
    json
    libxml
    mcrypt
    mhash
    mysqlnd
    odbc
    pcre
    PDO
    Phar
    Reflection
    session
    SimpleXML
    SPL
    standard
    tokenizer
    wddx
    xml
    xmlreader
    xmlwriter
    zip
    zlib [Zend Modules]
  • Ok. So PDO is loaded, but mysql/mysqli isn't. So you'll have to figure out why it is when you run php through apache, but not from the commandline. Perhaps this is something specific of your xAMP stack, maybe you can ask the question there? And it isn't an environment issue, where your application uses PDO, but oil is trying to use mysql? Check the db.php config files in the different environments. oil will use development if you haven't selected one.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion