2

The error text is :

sasql_connect(): The SQLAnywhere client libraries could not be loaded. Please ensure that libdbcapi_r.so can be found in your LD_LIBRARY_PATH environment variable.

I get this error when I run the code as a Laravel Job. However, SQL Anywhere connection is successful if I write a controller function.

I think, if there was a problem about my SQL Anywhere installation, I would face the same error in the controller function.

I am trying to find a solution for 3 days without hope.

All replies will be helpful.

Thanks.

  • Make sure that the extension is installed and turned on for all php installations - the one running the job is likely not the one your web server is running. – Joel Hinz Jan 21 '18 at 19:39
  • 1
    To debug this you can queue a job that dumps `phpinfo()` to a file and compare that with the output of `phpinfo()` from the web interface to see what the difference is. – apokryfos Jan 21 '18 at 19:44
  • Thanks, How can I turn on the extension for all php installation? And @apokryfos thank, I will do that – muhammed safa yaşar Jan 21 '18 at 19:51
  • 1
    @muhammedsafayaşar ideally you wouldn't really need to if you can manage to get bot the queue and the web interface to use the same PHP installation. Usually this is a problem with which php binary is put in the `/usr/bin` path. – apokryfos Jan 21 '18 at 19:53
  • Thanks @apokryfos. Yes there is a difference between apache and jobs. Apache uses /etc/php/5.6/apache2 whereas job queue uses /etc/php/5.6/cli. And in phpinfo that I wrote in a file by job queue, LD_LIBRARY_PATH is not defined. But I do not know how to set it for php/5.6/cli. Can you help about that? – muhammed safa yaşar Jan 21 '18 at 21:29
  • Edit the PHP.ini in /etc/PHP/5.6/cli and make it look like the one in /etc/PHP/5.6/apache2 – apokryfos Jan 21 '18 at 21:44
  • @apokryfos Thanks a lot. But didn't work. I set the LD_LIBRARY_PATH and I see it in phpinfo generated by laravel job. But didn't work. I still get the same error. – muhammed safa yaşar Jan 21 '18 at 23:35
  • I found a solution. The problem was not about php versions. It was because supervisor (I use it for monitoring queued jobs). I set environment variable in /etc/supervisor/conf.d/my-worker.conf "environment=LD_LIBRARY_PATH=/opt/sqlanywhere17/lib64" After updating supervisor ("supervisorctl update") everything worked well. Thanks a lot @apokryfos – muhammed safa yaşar Jan 22 '18 at 23:57

1 Answers1

0

I found a solution. The problem was not about php versions. It was because supervisor (I use it for monitoring queued jobs). I set environment variable in /etc/supervisor/conf.d/my-worker.conf environment=LD_LIBRARY_PATH=/opt/sqlanywhere17/lib64 After updating supervisor ("supervisorctl update") everything worked well.