7

I have a .so file generated with SWIG. I would like use the functions defined there as a php extension. How do I add them as a php extension?

I added the .so to the extensions directory, and in php.ini added a line: "extension=example.so", then restarted apache.

Still when I run: php -d "extension=example.so" -m, it does not appear as an extension, and says: "Unable to load dynamic library '/usr/lib/php5/...../example.so. cannot open shared object file: Permission denied in Unknown on line 0"

Yet, permissions are 777

Permisions

permissions

PHP .so folder

extensions folder

php.ini file

php.ini file enter image description here

checking for extension [checking for extension[5]

Extension "example.so" not there.

OliverGainess
  • 163
  • 1
  • 8

1 Answers1

5

Solved by adding the full path of the .so to the php.ini

extension=/full/path/to/so/example.so

Therefore, adding the .so to the php extensions folder is unnecessary. The .so may reside in any directory.

OliverGainess
  • 163
  • 1
  • 8