1

I am having an issue getting a simple controller to run as a shell command.

The controller is simply:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

    class Check_C extends CI_Controller {

        // Fire up the new controller, make sure to extend the parent
        public function __construct(){
            parent::__construct();
        }


        public function runcheck(){
            echo 'HI'; //$this->input->is_cli_request();
        }

    }

?>

and the command I am running from the root of the app is:

php index.php check_c runcheck

The output is:

PHP Warning: Module 'mysql' already loaded in Unknown on line 0

Now, I did a little searching and see that it could be the way my php install is compiled, and/or configured.

I have verified, this is a default install of PHP on Ubuntu Server 13.10...so I do not know if mysql is complied with PHP. I do know that the extension is loaded in my php.ini file, on top of this, I do not get this Warning on any page in the site.

How to do I fix it?

4
  • p.s. php version 5.5.3 Commented Mar 6, 2014 at 17:51
  • yes, and it states nothing about the issue in my question here Commented Mar 6, 2014 at 18:33
  • the warning pops even if I do some command as simply as php -m Commented Mar 6, 2014 at 18:43
  • 1
    The docs had a PHP_EOL which you don't, but that's not the issue. Something is loading mysql.so twice. colekcolek.com/2011/12/16/… and see @kevindeleon's answer. Commented Mar 6, 2014 at 20:12

1 Answer 1

2

This error is usually caused when an extension is being loaded twice. You have already verified that the extension is being loaded by your php.ini file. Check to see if the extension is also being loaded in a file under your conf.d (potentially in a mysql.ini file) folder. Not sure where those files reside in Ubuntu, but that is likely your problem. If it is in fact being loaded twice, then disable one. That should do the trick.

Sign up to request clarification or add additional context in comments.

2 Comments

i did find a 20-mysql.ini under /etc/php5/apache2/conf.d that had the extension= line in it... I commented it our, restarted apache, and every site that had a database attached to it died
found it again in the php5/cli/conf.d directory, and php.ini in there as well... I commented it out of php.ini and all seems to be well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.