0

In my local development environment its works fine, but when i deploy the lumen(5.2) project in server and when it's try to execute this line app('db')->select($sql, array($email)); then it's throw this exception

protected 'message' => string 'array_key_exists(): The first argument  should be either a string or an integer' (length=78)
private 'string' (Exception) => string '' (length=0)
protected 'code' => int 0
protected 'file' => string 
'/usr/src/app/api/vendor/illuminate/support/Arr.php' (length=50)
protected 'line' => int 145
private 'trace' (Exception) => 
array (size=32)
  0 => 
    array (size=4)
      'function' => string 'Laravel\Lumen\Concerns\{closure}' (length=32)
      'class' => string 'Laravel\Lumen\Application' (length=25)
      'type' => string '->' (length=2)
      'args' => 
        array (size=5)
          ...
  1 => 
    array (size=4)
      'file' => string '/usr/src/app/api/vendor/illuminate/support/Arr.php' (length=50)
      'line' => int 145
      'function' => string 'array_key_exists' (length=16)
      'args' => 
        array (size=2)
          ...
  2 => 
    array (size=6)
      'file' => string '/usr/src/app/api/vendor/illuminate/support/Arr.php' (length=50)
      'line' => int 280
      'function' => string 'exists' (length=6)
      'class' => string 'Illuminate\Support\Arr' (length=22)
      'type' => string '::' (length=2)
      'args' => 
        array (size=2)
          ...
  3 => 
    array (size=6)
      'file' => string '/usr/src/app/api/vendor/illuminate/database/DatabaseManager.php' (length=63)
      'line' => int 238
      'function' => string 'get' (length=3)
      'class' => string 'Illuminate\Support\Arr' (length=22)
      'type' => string '::' (length=2)
      'args' => 
        array (size=2)
          ...
  4 => 
    array (size=6)
      'file' => string '/usr/src/app/api/vendor/illuminate/database/DatabaseManager.php' (length=63)
      'line' => int 158
      'function' => string 'getConfig' (length=9)
      'class' => string 'Illuminate\Database\DatabaseManager' (length=35)
      'type' => string '->' (length=2)
      'args' => 
        array (size=1)
          ...
  5 => 
    array (size=6)
      'file' => string '/usr/src/app/api/vendor/illuminate/database/DatabaseManager.php' (length=63)
      'line' => int 68
      'function' => string 'makeConnection' (length=14)
      'class' => string 'Illuminate\Database\DatabaseManager' (length=35)
      'type' => string '->' (length=2)
      'args' => 
        array (size=1)
          ...
  6 => 
    array (size=6)
      'file' => string '/usr/src/app/api/vendor/illuminate/database/DatabaseManager.php' (length=63)
      'line' => int 317
      'function' => string 'connection' (length=10)
      'class' => string 'Illuminate\Database\DatabaseManager' (length=35)
      'type' => string '->' (length=2)
      'args' => 
        array (size=0)
          ...

I think its happen for set up environment in server , Please suggest me what i have to do..

3 Answers3

0

Did you enable error logging on your development machine?

Share your code which one is you're using with array_key_exists function.

Also share your current php version of development & server machine.

Sohel Amin
  • 11
  • 3
  • development `php 7.0.8` & server machine `PHP >= 5.6.4` – Jabed Hasan Oct 12 '16 at 11:26
  • I not enable error logging on my development machine – Jabed Hasan Oct 12 '16 at 12:06
  • If you don't enable or could not see the error while developing then how you solve or how you figured out from where the error is coming? Please check the log file. There maybe `array_key_exists` function got null param instead of array. And make sure you've the latest version of lumen. – Sohel Amin Oct 12 '16 at 14:10
  • Thank's @Sohel Amin, the problem was in my database connection. – Jabed Hasan Oct 13 '16 at 16:34
  • in my .env file the DB_CONNECTION field was set default "true" by Docker where as it should be postgresql deriver name "pgsql". – Jabed Hasan Oct 13 '16 at 16:35
0

I had the same problem right now. I've received an error max_memory_limit, but because of nothing. In that case WAMP/LAMP/XAMP restart should help. Mye be helpful for somebody... :)

0

please enable $app->withEloquent(); in bootstrap/app.php. If you are using db, you must do this.