dunglas/frankenphp

Call to undefined function session_save_path() after building standalone binary

fballiano opened this issue · 5 comments

What happened?

I was trying to build a standalone binary of a magento application on a mac, the build process works perfectly fine but then when I run the binary and open localhost in the browser I get the error in the title, I couldn't find any info on this anywhere.

Build Type

Standalone binary

Worker Mode

No

Operating System

macOS

CPU Architecture

Apple Silicon

PHP configuration

checking the phpinfo I can see:

'./configure' '--prefix=' '--with-valgrind=no' '--enable-shared=no' '--enable-static=yes' '--disable-all' '--disable-cgi' '--disable-phpdbg' '--disable-cli' '--disable-fpm' '--enable-embed=static' '--disable-micro' '--enable-zts' '--disable-zend-signals' '--enable-ctype' '--with-curl' '--enable-dom' '--with-zlib' '--with-zlib-dir=/private/tmp/frankenphp/dist/static-php-cli/buildroot' '--enable-gd' '--with-freetype' '--with-jpeg' '--with-webp' '--with-avif' '--with-iconv=/private/tmp/frankenphp/dist/static-php-cli/buildroot' '--enable-intl' '--enable-xml' '--enable-mbstring' '--disable-mbregex' '--enable-pdo' '--enable-simplexml' '--enable-soap' '--with-libxml=/private/tmp/frankenphp/dist/static-php-cli/buildroot' 'PKG_CONFIG=/private/tmp/frankenphp/dist/static-php-cli/buildroot/bin/pkg-config' 'PKG_CONFIG_PATH=/private/tmp/frankenphp/dist/static-php-cli/buildroot/lib/pkgconfig'

Relevant log output

Fatal error: Uncaught Error: Call to undefined function session_save_path() in /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:89 Stack trace: #0 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php(273): Mage_Core_Model_Session_Abstract_Varien->start('om_frontend') #1 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Model/Session/Abstract.php(79): Mage_Core_Model_Session_Abstract_Varien->init('core', 'om_frontend') #2 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Model/Session.php(43): Mage_Core_Model_Session_Abstract->init('core', 'om_frontend') #3 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Model/Config.php(1500): Mage_Core_Model_Session->__construct(Array) #4 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/Mage.php(484): Mage_Core_Model_Config->getModelInstance('core/session', Array) #5 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/Mage.php(498): Mage::getModel('core/session', Array) #6 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Controller/Varien/Action.php(712): Mage::getSingleton('core/session', Array) #7 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Controller/Varien/Action.php(698): Mage_Core_Controller_Varien_Action->setRedirectWithCookieCheck('install', Array) #8 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Controller/Varien/Action.php(479): Mage_Core_Controller_Varien_Action->_redirect('install') #9 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Controller/Front/Action.php(57): Mage_Core_Controller_Varien_Action->preDispatch() #10 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Controller/Varien/Action.php(413): Mage_Core_Controller_Front_Action->preDispatch() #11 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch('index') #12 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Controller/Varien/Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #13 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch() #14 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/Mage.php(700): Mage_Core_Model_App->run(Array) #15 /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/public/index.php(59): Mage::run('', 'store') #16 {main} thrown in /private/var/folders/gz/w7xyc6xs5_n0lhtw94cwdnhc0000gn/T/frankenphp_17d20bfcd3a7782c720df6992d83d27e/vendor/mahocommerce/maho/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 89

while building I saw it was building php8.3 but my app doesn't have a phpinfo so I don't know how to send this info

Without this, we can't really help you and all we can do is guess. My guess would be that you are missing the session extension in your build.

I rebuilt it in order to read a phpinfo and I see this:

'./configure' '--prefix=' '--with-valgrind=no' '--enable-shared=no' '--enable-static=yes' '--disable-all' '--disable-cgi' '--disable-phpdbg' '--disable-cli' '--disable-fpm' '--enable-embed=static' '--disable-micro' '--enable-zts' '--disable-zend-signals' '--enable-ctype' '--with-curl' '--enable-dom' '--with-zlib' '--with-zlib-dir=/private/tmp/frankenphp/dist/static-php-cli/buildroot' '--enable-gd' '--with-freetype' '--with-jpeg' '--with-webp' '--with-avif' '--with-iconv=/private/tmp/frankenphp/dist/static-php-cli/buildroot' '--enable-intl' '--enable-xml' '--enable-mbstring' '--disable-mbregex' '--enable-pdo' '--enable-simplexml' '--enable-soap' '--with-libxml=/private/tmp/frankenphp/dist/static-php-cli/buildroot' 'PKG_CONFIG=/private/tmp/frankenphp/dist/static-php-cli/buildroot/bin/pkg-config' 'PKG_CONFIG_PATH=/private/tmp/frankenphp/dist/static-php-cli/buildroot/lib/pkgconfig'

I'll try to force a PHP_EXTENSIONS list, rebuild and see what happens

OMG I'm so sorry, somehow I never new session was considered an extension, I've added ext-session to my composer.json, rebuilt and it works perfectly

@fballiano, Pro-tip: make sure you remove all polyfills in your project as well (search your vendor folder). You'll probably end up with something like this:

{
	"replace": {
		"symfony/polyfill-ctype": "*",
		"symfony/polyfill-intl-grapheme": "*",
		"symfony/polyfill-intl-normalizer": "*",
		"symfony/polyfill-mbstring": "*",
		"symfony/polyfill-uuid": "*",
		"symfony/polyfill-php80": "*"
	}
}

in your composer.json. Many projects just require the polyfills and don't specify the ext-* in their composer.json, making it easy to end up using polyfills instead of proper extensions.

@withinboredom this information is gold, thank you!