5

I'm trying to enable some php extensions needed by Laravel. The documentation for the php.ini file (https://cloud.google.com/appengine/docs/php/config/php_ini) says to place a php.ini file in the root of the application.

This is what my php.ini looks like:

extension=openssl.so
extension=pdo.so
extension=tokenizer.so
extension=mbstring.so
google_app_engine.enable_functions = "php_sapi_name, php_uname"

When I deploy it, my log says:

PHP Warning:  PHP Startup: Unable to load dynamic library '/base/php_runtime/modules/openssl.so' - /base/php_runtime/modules/openssl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/base/php_runtime/modules/pdo.so' - /base/php_runtime/modules/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/base/php_runtime/modules/tokenizer.so' - /base/php_runtime/modules/tokenizer.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/base/php_runtime/modules/mbstring.so' - /base/php_runtime/modules/mbstring.so: cannot open shared object file: No such file or directory in Unknown on line 0

I've tried changing the way I've formatted the extensions in php.ini:

extension="openssl.so"
extension="openssl.dll"
extension="php_openssl.so"
extension="php_openssl.dll"

I've tried it with quotations, and without them. With spaces in between them, without them. I'm not sure what else to try.

5
  • Are those libraries available? cloud.google.com/appengine/docs/php/… It seems like they aren't (I don't know why though). Commented Nov 9, 2015 at 14:45
  • 1
    I've figured out the problem. The documentation says that these modules are already loaded. And only imagick, curl, mongo, and intl need to be explicitly added to php.ini. Commented Nov 9, 2015 at 15:06
  • 1
    Removing the extension=* lines fixed it. Commented Nov 9, 2015 at 15:07
  • 1
    If you can, post that as the answer. Commented Nov 9, 2015 at 16:23
  • Posted an answer with my solution. Commented Nov 13, 2015 at 12:37

1 Answer 1

2

I figured out the problem.

When you serve the application locally and when you deploy, App Engine uses the php.ini file in the root of your application.

The problem was that when I ran it locally, I needed to have the extension=* lines in php.ini to load the necessary extensions. When I deployed it with those lines in php.ini, I got the error I reported in my question.

My solution is to have two different versions of php.ini: php.ini.local and php.ini.dev.

php.ini.local:

extension=mbstring.so
extension=pdo.so
extension=openssl.so
extension=tokenizer.so
google_app_engine.enable_functions = "php_sapi_name, php_uname"

php.ini.dev:

google_app_engine.enable_functions = "php_sapi_name, php_uname"

And use a Makefile to replace php.ini with either the dev version or local version depending on what I need.

Makefile:

deploy:
    cp php.ini.dev php.ini
    # Code used to deploy
serve:
    cp php.ini.local php.ini
    # Code used to serve locally
Sign up to request clarification or add additional context in comments.

Comments

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.