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.
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 inphp.ini
to load the necessary extensions. When I deployed it with those lines inphp.ini
, I got the error I reported in my question.My solution is to have two different versions of
php.ini
:php.ini.local
andphp.ini.dev
.php.ini.local
:php.ini.dev
:And use a Makefile to replace php.ini with either the dev version or local version depending on what I need.
Makefile
: