!jngDrdMgndWibPCYsR:nixos.org

Nix PHP

68 Members
A room for PHP developers running on Nix19 Servers

Load older messages


SenderMessageTime
20 Nov 2023
@jtojnar:matrix.orgJan Tojnar(or if the consumer loads the symbols dynamically)22:20:19
21 Nov 2023
@Zevran:matrix.orgGaël ReyrolHonestly I am not quite fan of the embedded thing that Kevin is trying to do with FrankenPHP, I don't think it is the responsibility of FrankenPHP to embed it, nor Apache and Nginx. It also adds a lot of compilation / cross compilation complexity , so maybe it is right way or a least a not so bad alternative.06:55:54
@Zevran:matrix.orgGaël Reyrol * Honestly I am not quite fan of the embedded thing that Kevin is trying to do with FrankenPHP, I don't think it is the responsibility of FrankenPHP to embed it, nor Apache and Nginx. It also adds a lot of compilation / cross compilation complexity, so maybe it is right way or a least at not so bad alternative.07:00:10
@Zevran:matrix.orgGaël Reyrol * Honestly I am not quite fan of the embedded thing that Kevin is trying to do with FrankenPHP, I don't think it is the responsibility of FrankenPHP to embed it, nor Apache and Nginx. It also adds a lot of compilation / cross compilation complexity, so maybe it is right way or at least a not so bad alternative.07:00:25
@wjjunyor:matrix.orgw
In reply to @drupol:matrix.org
w: Let us know how we can help.
Had no time to work on it.
07:25:31
@stotes:matrix.orgAdam Stotesbury joined the room.07:37:15
@stotes:matrix.orgAdam Stotesbury

I'm currently facing an issue with registering the php74Extensions.redis in my NixOS environment, and I'm seeking some guidance to resolve it.
I'm able to get xdebug to correctly register with the zend_extension = "${php.php74Extensions.xdebug}/lib/php/extensions/xdebug.so" and I've can see the redis.so exists in the nixstore path /nix/store/hnjkll3gvx7nm8i7vm1mc1cpa4b1p3lh-php-redis-5.3.4/lib/php/extensions/ for the php74Extensions.redis package. However phpinfo fails to register the redis package (xdebug is showing as expected and changed to the config or removing the xdebug.so entry reflect the phpinfo.)

Here's a brief overview of my configuration:

configuration.nix:

{ config, pkgs, lib, ... }:
let
  php = import
    (builtins.fetchTarball {
      url = "https://github.com/NixOS/nixpkgs/archive/2766f77c32e171a04d59b636a91083bae862274e.tar.gz"; #7.4.29 php
    })
    { };
in
{
  imports =
    [
      # Include the results of the hardware scan.
      ./hardware-configuration.nix
      (import /home/stotes/nix/server/nginx-php.nix { inherit config php lib pkgs; })
    ];
    # ... continues
}

nginx-php.nix:

{ config, pkgs, lib, php, ... }:
{
  environment.systemPackages = with php; [
    php.php74
    php.phpPackages.composer
    php.php74Extensions.pdo
    php.php74Extensions.redis
    php.php74Extensions.xdebug
  ];

  services.phpfpm.phpOptions = ''
    date.timezone = Australia/Brisbane
    extension = "${php.php74Extensions.redis}/lib/php/extensions/redis.so"
    zend_extension = "${php.php74Extensions.xdebug}/lib/php/extensions/xdebug.so"
  '';
}

nix-created php.ini entries:

date.timezone = Australia/Brisbane
extension = "/nix/store/hnjkll3gvx7nm8i7vm1mc1cpa4b1p3lh-php-redis-5.3.4/lib/php/extensions/redis.so"
zend_extension = "/nix/store/hsprflbbk5a0hqaysm7vaspqmn2l1nyg-php-xdebug-3.0.4/lib/php/extensions/xdebug.so"

Despite my configuration, the php74Extensions.redis package is not registering as expected. I've followed the NixOS documentation and community forums but couldn't find a solution. Can someone please guide me on what might be causing this issue or any steps I can take to troubleshoot it further?

Any help or insights would be greatly appreciated. Thank you in advance for your assistance!

07:38:04
@drupol:matrix.org@drupol:matrix.orgDo you have any issue in the log while loading PHP (including the redis extensions) ?07:42:22
@rikudou:lemmings.worldrikudou@lemmings.world joined the room.07:44:01
@rikudou:lemmings.worldrikudou@lemmings.world

This is my (working) config. Unless something changed in between versions, you can adapt it to php74:

environment.systemPackages = with pkgs; let
   php82 = pkgs.php82.buildEnv {
     extensions = ({ enabled, all }: enabled ++ (with all; [
       xdebug
       redis
       xsl
       ffi
     ]));
     extraConfig = ''
       memory_limit=8G
       xdebug.mode=debug
     '';
  };
    in
  [
    php82
    php82.packages.composer
    php82Extensions.redis
    php82Extensions.xsl
  ];
07:47:26
@stotes:matrix.orgAdam Stotesbury
In reply to @drupol:matrix.org
Do you have any issue in the log while loading PHP (including the redis extensions) ?
NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/nix/store/hnjkll3gvx7nm8i7vm1mc1cpa4b1p3lh-php-redis-5.3.4/lib/php/extensions/redis.so' (tried: /nix/store/hnjkll3gvx7nm8i7vm1mc1cpa4b1p3lh-php-redis-5.3.4/lib/php/extensions/redis.so (/nix/store/hnjkll3gvx7nm8i7vm1mc1cpa4b1p3lh-php-redis-5.3.4/lib/php/extensions/redis.so: undefined symbol: php_session_create_id), /nix/store/nx5jg5b1zkljhzxn6g9b6sjkj9539mhg-php-7.4.29/lib/php/extensions//nix/store/hnjkll3gvx7nm8i7vm1mc1cpa4b1p3lh-php-redis-5.3.4/lib/php/extensions/redis.so.so (/nix/store/nx5jg5b1zkljhzxn6g9b6sjkj9539mhg-php-7.4.29/lib/php/extensions//nix/store/hnjkll3gvx7nm8i7vm1mc1cpa4b1p3lh-php-redis-5.3.4/lib/php/extensions/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
07:50:52
@drupol:matrix.org@drupol:matrix.org
/nix/store/hnjkll3gvx7nm8i7vm1mc1cpa4b1p3lh-php-redis-5.3.4/lib/php/extensions/redis.so: undefined symbol: php_session_create_id)
07:51:28
@drupol:matrix.org@drupol:matrix.orgWeird.07:51:34
@drupol:matrix.org@drupol:matrix.orgI would suggest to use this project: https://github.com/fossar/nix-phps07:51:47
@drupol:matrix.org@drupol:matrix.orgIt contains old versions of PHPs07:52:01
@drupol:matrix.org@drupol:matrix.orgYou might have better chance with it07:52:06
@stotes:matrix.orgAdam Stotesburyhttps://github.com/phpredis/phpredis/issues/470 According to this thread loading session.so before redis.so can resolve the issue.07:54:39
@drupol:matrix.org@drupol:matrix.orgOooh indeed !07:55:13
@drupol:matrix.org@drupol:matrix.orgI forgot about this 07:55:19
@drupol:matrix.org@drupol:matrix.orgTry and let me know07:55:23
@rikudou:lemmings.worldrikudou@lemmings.world Adam Stotesbury: Have you tried using my config? 07:55:39
@stotes:matrix.orgAdam Stotesbury
In reply to @rikudou:lemmings.world

This is my (working) config. Unless something changed in between versions, you can adapt it to php74:

environment.systemPackages = with pkgs; let
   php82 = pkgs.php82.buildEnv {
     extensions = ({ enabled, all }: enabled ++ (with all; [
       xdebug
       redis
       xsl
       ffi
     ]));
     extraConfig = ''
       memory_limit=8G
       xdebug.mode=debug
     '';
  };
    in
  [
    php82
    php82.packages.composer
    php82Extensions.redis
    php82Extensions.xsl
  ];
Thanks for sharing. I'll give this a crack
07:56:16
@stotes:matrix.orgAdam Stotesbury
In reply to @rikudou:lemmings.world
Adam Stotesbury: Have you tried using my config?
Not quite yet. Will do shortly
07:56:25
@rikudou:lemmings.worldrikudou@lemmings.world Here's a fully working shell.nix with what you want, it can easily.3 .. 07:56:37
@rikudou:lemmings.worldrikudou@lemmings.world *

Here's a fully working shell.nix with what you want, it can easily be adapted:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
    nativeBuildInputs = with pkgs.buildPackages;
    let
      custom = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/0e4ade244d0f1b01a378aa58c235a1576778c1fd) {};
      php74 = pkgs.php.buildEnv {
        extensions = ({ enabled, all }: enabled ++ (with all; [
          redis
          xdebug
        ]));
        extraConfig = ''
          xdebug.mode=debug
          date.timezone=Australia/Brisbane
        '';
      };
    in
    [
      php74
      custom.phpPackages.composer
      custom.php74Extensions.pdo
      custom.php74Extensions.redis
      custom.php74Extensions.xdebug
    ];
}
07:56:59
@rikudou:lemmings.worldrikudou@lemmings.world *

Here's a fully working shell.nix with what you want, it can easily be adapted to configuration.nix:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
    nativeBuildInputs = with pkgs.buildPackages;
    let
      custom = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/0e4ade244d0f1b01a378aa58c235a1576778c1fd) {};
      php74 = pkgs.php.buildEnv {
        extensions = ({ enabled, all }: enabled ++ (with all; [
          redis
          xdebug
        ]));
        extraConfig = ''
          xdebug.mode=debug
          date.timezone=Australia/Brisbane
        '';
      };
    in
    [
      php74
      custom.phpPackages.composer
      custom.php74Extensions.pdo
      custom.php74Extensions.redis
      custom.php74Extensions.xdebug
    ];
}
07:57:11
@stotes:matrix.orgAdam StotesburyThank you! 07:57:33
@rikudou:lemmings.worldrikudou@lemmings.world *

Here's a fully working shell.nix with what you want, it can easily be adapted to configuration.nix:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
    nativeBuildInputs = with pkgs.buildPackages;
    let
      custom = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/1d8b8365a02efbf668311dc9db06cb98d49e7302) {};
      php74 = pkgs.php74.buildEnv {
        extensions = ({ enabled, all }: enabled ++ (with all; [
          redis
          xdebug
        ]));
        extraConfig = ''
          xdebug.mode=debug
          date.timezone=Australia/Brisbane
        '';
      };
    in
    [
      php74
      custom.phpPackages.composer
      custom.php74Extensions.pdo
      custom.php74Extensions.redis
      custom.php74Extensions.xdebug
    ];
}
07:57:49
@rikudou:lemmings.worldrikudou@lemmings.world *

Here's a fully working shell.nix with what you want, it can easily be adapted to configuration.nix:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
    nativeBuildInputs = with pkgs.buildPackages;
    let
      custom = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/0e4ade244d0f1b01a378aa58c235a1576778c1fd) {};
      php74 = pkgs.php.buildEnv {
        extensions = ({ enabled, all }: enabled ++ (with all; [
          redis
          xdebug
        ]));
        extraConfig = ''
          xdebug.mode=debug
          date.timezone=Australia/Brisbane
        '';
      };
    in
    [
      php74
      custom.phpPackages.composer
      custom.php74Extensions.pdo
      custom.php74Extensions.redis
      custom.php74Extensions.xdebug
    ];
}
07:58:19
@rikudou:lemmings.worldrikudou@lemmings.world *

Here's a fully working shell.nix with what you want, it can easily be adapted to configuration.nix:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
    nativeBuildInputs = with pkgs.buildPackages;
    let
      custom = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/1d8b8365a02efbf668311dc9db06cb98d49e7302) {};
      php74 = custom.php74.buildEnv {
        extensions = ({ enabled, all }: enabled ++ (with all; [
          redis
          xdebug
        ]));
        extraConfig = ''
          xdebug.mode=debug
          date.timezone=Australia/Brisbane
        '';
      };
    in
    [
      php74
      custom.php74Packages.composer
      custom.php74Extensions.pdo
      custom.php74Extensions.redis
      custom.php74Extensions.xdebug
    ];
}
07:59:59

Show newer messages


Back to Room ListRoom Version: 6