Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Can't Run
  • Hi,
    I'm really new to fuelPHP, I'm currently checking out the migrations and the Oil tool. I have done test migrations in the past with no issues (version 1.2.1), I just got the latest version of Fuel last night (version 1.3) and I now get this error messages:
    # oil r migrate
    PHP Fatal error:  Undefined class constant 'MYSQL_ATTR_COMPRESS' in /.../www/projects/fuel-blog/fuel/core/classes/database/pdo/connection.php on line 83
    PHP Stack trace:
    PHP   1. {main}() /.../www/projects/fuel-blog/oil:0
    PHP   2. Oil\Command::init() /.../www/projects/fuel-blog/oil:46
    PHP   3. call_user_func() /.../www/projects/fuel-blog/fuel/packages/oil/classes/command.php:119
    PHP   4. Oil\Refine::run() /.../www/projects/fuel-blog/fuel/packages/oil/classes/command.php:119
    PHP   5. call_user_func_array() /.../www/projects/fuel-blog/fuel/packages/oil/classes/refine.php:99
    PHP   6. Fuel\Tasks\Migrate->__call() /.../www/projects/fuel-blog/fuel/packages/oil/classes/refine.php:0
    PHP   7. Fuel\Tasks\Migrate::_run() /.../www/projects/fuel-blog/fuel/core/tasks/migrate.php:150
    PHP   8. Fuel\Core\Autoloader::load() /.../www/projects/fuel-blog/fuel/core/tasks/migrate.php:0
    PHP   9. Fuel\Core\Autoloader::init_class() /.../www/projects/fuel-blog/fuel/core/classes/autoloader.php:247
    PHP  10. call_user_func() /.../www/projects/fuel-blog/fuel/core/classes/autoloader.php:352
    PHP  11. Fuel\Core\Migrate::_init() /.../www/projects/fuel-blog/fuel/core/classes/autoloader.php:352
    PHP  12. Fuel\Core\Migrate::table_version_check() /.../www/projects/fuel-blog/fuel/core/classes/migrate.php:66
    PHP  13. Fuel\Core\DBUtil::table_exists() /.../www/projects/fuel-blog/fuel/core/classes/migrate.php:541
    PHP  14. Fuel\Core\Database_Query->execute() /.../www/projects/fuel-blog/fuel/core/classes/dbutil.php:561
    PHP  15. Fuel\Core\Database_PDO_Connection->query() /.../www/projects/fuel-blog/fuel/core/classes/database/query.php:256
    PHP  16. Fuel\Core\Database_PDO_Connection->connect() /.../www/projects/fuel-blog/fuel/core/classes/database/pdo/connection.php:141
    Error - Undefined class constant 'MYSQL_ATTR_COMPRESS' in COREPATH/classes/database/pdo/connection.php on line 83
    

    I have updated my /app/config/development/db.php and /app/config/production/db.php files. I'm really stuck, not sure if is a bug in the new version or if there is something I'm missing. I'm starting with a new project from scratch using oil:
    oil create fuel-blog
    cd fuel-blog/
    oil g scaffold post title:varchar[255] description:text content:text
    oil refine migrate
    or 
    oil r migrate
    
    Any help is appreciated. Onema
  • Please create an issue for this at http://github.com/fuel/core/issues so someone can have a look at it. Your PHP is probably compiled with the mysqlnd driver, which does not support compression. As a workaround you can simply comment line 83 in the pdo connection driver.
  • Cool,
    I'll do, BTW my version of php:
    PHP 5.3.8 (cli) (built: Dec 5 2011 21:24:09)
  • I'm now getting this error message after I updated the file.
    # oil r migrate
    PHP Fatal error:  Undefined class constant 'MYSQL_ATTR_COMPRESS' in /.../www/projects/fuel-blog/fuel/core/classes/database/pdo/connection.php on line 80
    PHP Stack trace:
    PHP   1. {main}() /.../www/projects/fuel-blog/oil:0
    PHP   2. Oil\Command::init() /.../www/projects/fuel-blog/oil:46
    PHP   3. call_user_func() /.../www/projects/fuel-blog/fuel/packages/oil/classes/command.php:119
    PHP   4. Oil\Refine::run() /.../www/projects/fuel-blog/fuel/packages/oil/classes/command.php:119
    PHP   5. call_user_func_array() /.../www/projects/fuel-blog/fuel/packages/oil/classes/refine.php:99
    PHP   6. Fuel\Tasks\Migrate->__call() /.../www/projects/fuel-blog/fuel/packages/oil/classes/refine.php:0
    PHP   7. Fuel\Tasks\Migrate::_run() /.../www/projects/fuel-blog/fuel/core/tasks/migrate.php:150
    PHP   8. Fuel\Core\Autoloader::load() /.../www/projects/fuel-blog/fuel/core/tasks/migrate.php:0
    PHP   9. Fuel\Core\Autoloader::init_class() /.../www/projects/fuel-blog/fuel/core/classes/autoloader.php:247
    PHP  10. call_user_func() /.../www/projects/fuel-blog/fuel/core/classes/autoloader.php:352
    PHP  11. Fuel\Core\Migrate::_init() /.../www/projects/fuel-blog/fuel/core/classes/autoloader.php:352
    PHP  12. Fuel\Core\Migrate::table_version_check() /.../www/projects/fuel-blog/fuel/core/classes/migrate.php:66
    PHP  13. Fuel\Core\DBUtil::table_exists() /.../www/projects/fuel-blog/fuel/core/classes/migrate.php:541
    PHP  14. Fuel\Core\Database_Query->execute() /.../www/projects/fuel-blog/fuel/core/classes/dbutil.php:561
    PHP  15. Fuel\Core\Database_PDO_Connection->query() /.../www/projects/fuel-blog/fuel/core/classes/database/query.php:256
    PHP  16. Fuel\Core\Database_PDO_Connection->connect() /.../www/projects/fuel-blog/fuel/core/classes/database/pdo/connection.php:141
    Error - Undefined class constant 'MYSQL_ATTR_COMPRESS' in COREPATH/classes/database/pdo/connection.php on line 80
    
    
  • That is odd, according to the PHP manual it's perfectly fine to use defined() to check for existence of a class constant. Do you have compression enabled in your db config? If not, it shouldn't even get to the original line in the first place. Can you check if you got mysqlnd compiled in instead of mysql?
  • I have not turned on compression, if it is on my default I couldn't find where to set it. I looked in app/config/development/db.php, production/db.php, and db.php. There is no reference to compression there.
  • Even more odd. If in that code in connection.php $compress == false, it will not even go into the if() that uses the constant. To solve your issue just remove that if(), if you don't use compression it's not needed. I'll add an issue for this so it can be looked at. edit: looks like the guy that introduced this code has set the default to true. So if you set "'compress' => false" in the connection definition of your db.php it should be solved too.
  • I was having the same problem 5 minutes ago. I commented the if() and now it works for me.
  • It's been fixed for 1.4/develop ( see https://github.com/fuel/core/commit/350234f2855351a24a8d126f1476aa64061a6a6f ). You can port the driver back to your 1.3 installation if needed.
  • mgabrielro wrote on Wednesday 19th of September 2012:
    I was having the same problem 5 minutes ago. I commented the if() and now it works for me.

    There is no need to comment out anything, just set
    $compress == false
    

    Like Harro said and you should be good to go.
    Thanks Harro for taking care of this.

Howdy, Stranger!

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

In this Discussion