Closed codeagencybe closed 2 years ago
This should work with any PHP application, and WordPress is definitely one of the main goals. But I've not tested it yet. Any help on this is welcome!
@dunglas
OK that is nice to hear! At the moment a bit busy with projects that need to be finished this week, but I will try to spend some time on testing this weekend. I have a local officelab server running here with Docker and K3s where I can do some testing. I like the idea a lot about using Go as a webserver. It's a lot faster. Really curious how it handles multi threading and heavy load Wordpress projects.
Is it also possible to disable Caddy and use my own ingress like Traefik? Or will that break some functionality?
This should work if you use the standalone go library and patch Caddy to use it, but again I've not tested that 😅
Maybe you'll have to compile your own Træfik instance with frankenPHP or patch the frakenPHP lib to work as plugin with Træfik because of the Yaegi usage inside Træfik. They disable some libraries to load plugins inside that (like unsafe) and I don't know if the C lib is authorized inside Træfik. (cc @ldez)
I got WordPress working by providing $_SERVER['PHP_SELF'] manually here.
@dylanblokhuis thanks for the research! Would you mind opening a pull request? This env var should probably be set here: https://github.com/dunglas/frankenphp/blob/main/cgi.go#L15
@dylanblokhuis How did you install the MySQL extension? When starting WordPress using the latest dunglas/frankenphp
Docker image I get an error about missing mysql_connect()
:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /app/public/wp-includes/wp-db.php:1788 Stack trace: #0 /app/public/wp-includes/wp-db.php(724): wpdb->db_connect() #1 /app/public/wp-includes/load.php(561): wpdb->__construct('app', 'app', 'app', 'db') #2 /app/public/wp-settings.php(124): require_wp_db() #3 /app/public/wp-config.php(98): require_once('/app/public/wp-...') #4 /app/public/wp-load.php(50): require_once('/app/public/wp-...') #5 /app/public/wp-blog-header.php(13): require_once('/app/public/wp-...') #6 /app/public/index.php(17): require('/app/public/wp-...') #7 {main} thrown in /app/public/wp-includes/wp-db.php on line 1788
@khromov create a new image using dunglas/frankenphp
and use install-php-extensions
to install the required WordPress php extensions, dont forget to enable them in your php.ini aswell
@khromov documentation for said script lives here: https://github.com/mlocati/docker-php-extension-installer and
An example of the Dockerfile might look like:
FROM dunglas/frankenphp:latest
RUN install-php-extensions mysqli
# any other extension from the table: https://github.com/mlocati/docker-php-extension-installer#supported-php-extensions
# untested, and not 100% sure of these paths
COPY --from=wordpress:latest /var/lib/html /app/public
# profit?
Here is a fully working example: https://github.com/dunglas/frankenphp-wordpress
cc @dragoonis
Can this run WordPress also or is it targeting custom symphony applications only?