简体   繁体   中英

Message: Module 'imagick' already loaded

I'm trying implement a custom php query in codeigniter. but I'm getting this error "imagick". Here is custom php code that is working perfect

$query = sprintf("SELECT id , address, name, lat, lng , planted ,
( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * 
  cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * 
  sin( radians( lat ) ) ) ) AS distance FROM plant 
  HAVING distance < '%s' AND planted is %s ORDER BY distance 
  LIMIT 0 , 10", 
  mysqli_real_escape_string($connection, $center_lat), 
  mysqli_real_escape_string($connection, $center_lng), 
  mysqli_real_escape_string($connection, $center_lat), 
  mysqli_real_escape_string($connection, $radius), 
  mysqli_real_escape_string($connection, $planted)); 

 $result = mysqli_query($connection,$query);

Here is the codeigniter code that I have written

  $query = "SELECT id, name, lat, lon, 
    (3959 * acos( cos( radians($lat) ) * cos( radians( lat ) ) * 
    cos( radians( lon ) - radians($lon) ) + sin( radians($lat) ) * 
    sin( radians( lat ) ) ) ) AS radius FROM users 
    HAVING radius < $radius ORDER BY radius";

    $query = $this->db->query($query);

This error is only occurring for this query only. Please help.

Screenshot: Error Screen

Check your php.ini file, maybe there are two extension=imagick.so lines. If yes then you should comment one of this

imagick is an image processing and creation package that is part of PHP.

By default, it is not used by CodeIgniter although it can be used by the Image Manipulation Class if the developer explicitly chooses it.

Imagick is a dynamic extension to PHP. Normally, it would be loaded in php.ini but PHP allows modules to be loaded at runtime using the function dl() . CodeIgniter does not ever use dl() to load imagick .

I'm not seeing any obvious use of image manipulation in the query. The error message says nothing about the database.

Based on those facts, code that runs either before or after the query is producing the error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM