Open nguyen-quang-phu opened 1 month ago
@nguyen-quang-phu, do you need to read the .ini
file? Have you tried builtins.readFile
?
Hi @sandydoo i use buildPecl to add 1 extension, but it don't add in php.ini, i don't know how to add it and get path in nix to add php.ini. can you give me 1 solution, thank you so much.
I dug into this a bit and it turns out that, if the version
option is set, we forcibly override the package. We should fix that.
For now, you'll have to remove version
from your config and set it up manually:
{
pkgs,
lib,
config,
...
}: let
cfg = config.languages.php;
phps = config.lib.getInput {
name = "phps";
url = "github:fossar/nix-phps";
attribute = "languages.php.version";
follows = [ "nixpkgs" ];
};
version = "72";
package = phps.packages.${pkgs.stdenv.system}."php${version}";
getExtensions = extensions: all: lib.attrValues (lib.getAttrs extensions all);
oauth = package.buildPecl {
pname = "oauth";
version = "2.0.7";
sha256 = "1G9ZBy8a3mXPTENTt+z1VG0cVsrWAhUstLpyq7GqXuw=";
buildInputs = [pkgs.pcre pkgs.pcre2];
};
in {
cachix.pull = [ "fossar" ];
languages.php = {
enable = true;
extensions = [
"gd"
"pdo"
"pdo_mysql"
];
package = package.buildEnv {
extensions = { enabled, all, }:
# We have to re-enabled the built-in extensions here and add our oauth one
enabled ++ (getExtensions cfg.extensions all) ++ [oauth];
};
fpm.pools.web = {
settings = {
"pm" = "dynamic";
"pm.max_children" = 5;
"pm.start_servers" = 2;
"pm.min_spare_servers" = 1;
"pm.max_spare_servers" = 5;
};
};
};
}
➜ php --ini
Configuration File (php.ini) Path: /nix/store/dihp63953y7blhw37q6klmy51yprhmrc-php-7.2.34/lib
Loaded Configuration File: (none)
Scan for additional .ini files in: /nix/store/gg693y55j73ah8y3f5iyj6zj08sw3n8x-php-with-extensions-7.2.34/lib
Additional .ini files parsed: /nix/store/gg693y55j73ah8y3f5iyj6zj08sw3n8x-php-with-extensions-7.2.34/lib/php.ini
➜ cat /nix/store/gg693y55j73ah8y3f5iyj6zj08sw3n8x-php-with-extensions-7.2.34/lib/php.ini
extension=/nix/store/by8d7kn3jbaqjkhv0mwa755k8iv9p48s-php-bcmath-7.2.34/lib/php/extensions/bcmath.so
extension=/nix/store/1h3im2dkzygyps8c6a5mdv2m8ifjq0hg-php-calendar-7.2.34/lib/php/extensions/calendar.so
extension=/nix/store/i7c47p2mbsn9fk2xq2dgy170w888m10l-php-curl-7.2.34/lib/php/extensions/curl.so
extension=/nix/store/zfgyy578iby6hb2kcfsbj8glazislh0d-php-ctype-7.2.34/lib/php/extensions/ctype.so
extension=/nix/store/5ql0l34rlhr567a1cpd74is2x8dc6qym-php-dom-7.2.34/lib/php/extensions/dom.so
extension=/nix/store/b1lymbh9cll48fllblivvcd7r5jcmn9n-php-exif-7.2.34/lib/php/extensions/exif.so
extension=/nix/store/949anqfd6gdwrj99sdx30jqix0mlk2qm-php-fileinfo-7.2.34/lib/php/extensions/fileinfo.so
extension=/nix/store/52r26vih313sfrn4yfny408pjdzv5w2z-php-filter-7.2.34/lib/php/extensions/filter.so
extension=/nix/store/igp8sq77cqds6qmbg591wbv303gxkw1d-php-ftp-7.2.34/lib/php/extensions/ftp.so
extension=/nix/store/9wn37ypyr96xsvfz3sxsqgk0vrn2g0a1-php-gd-7.2.34/lib/php/extensions/gd.so
extension=/nix/store/fcpkdk14lgxq7ljfh56lqiq3zggwa3sa-php-gettext-7.2.34/lib/php/extensions/gettext.so
extension=/nix/store/9x970v3mj1frnb6ix9s58yz3ihmws1x9-php-gmp-7.2.34/lib/php/extensions/gmp.so
extension=/nix/store/jsvv4lcih4f9nx5i1lzx2xp6hjzi1c16-php-iconv-7.2.34/lib/php/extensions/iconv.so
extension=/nix/store/3d8032kxllizks03sb9jfzmds4qhlby6-php-intl-7.2.34/lib/php/extensions/intl.so
extension=/nix/store/hi607k9lqpmsgjcn5313980g6sav7rgn-php-json-7.2.34/lib/php/extensions/json.so
extension=/nix/store/0pj888ws01shgddrdgbd48m3zypwha0l-php-ldap-7.2.34/lib/php/extensions/ldap.so
extension=/nix/store/qh5aj2cvzm5fr1vr874yjdlr24lh3iij-php-mbstring-7.2.34/lib/php/extensions/mbstring.so
extension=/nix/store/cdqbizxxq9cfq5g1cbr3njr42wk0xvfw-php-mysqlnd-7.2.34/lib/php/extensions/mysqlnd.so
extension=/nix/store/99f25g8dz0yyc4bmksi4yrh2prkzlwaj-php-mysqli-7.2.34/lib/php/extensions/mysqli.so
zend_extension=/nix/store/396m56y9xxyrnapslxs3g6vd2gdl876a-php-opcache-7.2.34/lib/php/extensions/opcache.so
extension=/nix/store/r9k410k4n01z7q3nxvqrw9b6ibngwsnc-php-openssl-7.2.34/lib/php/extensions/openssl.so
extension=/nix/store/8gjby3gdjbg00pfgir1dqmgv6yv0yx4d-php-pcntl-7.2.34/lib/php/extensions/pcntl.so
extension=/nix/store/ic70ai0j42gybypx74yf17rl13a2062i-php-pdo-7.2.34/lib/php/extensions/pdo.so
extension=/nix/store/mjhrndfm2pjlc5hggdx5psf4gaqs4x77-php-pdo_mysql-7.2.34/lib/php/extensions/pdo_mysql.so
extension=/nix/store/wji937ryy4kbqsc61s1flsi0xd63a8bs-php-pdo_odbc-7.2.34/lib/php/extensions/pdo_odbc.so
extension=/nix/store/a4w0adwm62yvfb3a6w9d7z9sb1xz5m61-php-pdo_pgsql-7.2.34/lib/php/extensions/pdo_pgsql.so
extension=/nix/store/vzlifngw549jkphm3i6dzm53k736vdf6-php-pdo_sqlite-7.2.34/lib/php/extensions/pdo_sqlite.so
extension=/nix/store/qxr6137fgyf9zy2liy4bk7aplgdms9cq-php-pgsql-7.2.34/lib/php/extensions/pgsql.so
extension=/nix/store/h73iabhqpmmil26h018yv3rjwv133zkh-php-posix-7.2.34/lib/php/extensions/posix.so
extension=/nix/store/3as1029aml6pvigklgabfjjm4rzs3hnj-php-readline-7.2.34/lib/php/extensions/readline.so
extension=/nix/store/ms7wb45lpdj1kq9qlm58vjvjs6qhl42x-php-session-7.2.34/lib/php/extensions/session.so
extension=/nix/store/5vnb4gypaxg98cz4i6z48pn4xzhr0fbm-php-simplexml-7.2.34/lib/php/extensions/simplexml.so
extension=/nix/store/i8nn2dpd58dg8y53kwyih9ix8s9ch7g0-php-sockets-7.2.34/lib/php/extensions/sockets.so
extension=/nix/store/s4p2xai4dpgpgff1ab30s9bg4v7jgpq2-php-soap-7.2.34/lib/php/extensions/soap.so
extension=/nix/store/2nab8s491wj272f55sw7g74ry8ciwink-php-sodium-7.2.34/lib/php/extensions/sodium.so
extension=/nix/store/ic0wi27sz62w7jmn316dm64v3ij83dk9-php-sysvsem-7.2.34/lib/php/extensions/sysvsem.so
extension=/nix/store/rcm3bnndal5m5bm7dcxd0wybs8zaq34j-php-sqlite3-7.2.34/lib/php/extensions/sqlite3.so
extension=/nix/store/34z9s17cs29wxbjzy58551af6km42snq-php-tokenizer-7.2.34/lib/php/extensions/tokenizer.so
extension=/nix/store/fcw5lb2cdw1yc6sgi1wwgxr1k3dmxrfw-php-xmlreader-7.2.34/lib/php/extensions/xmlreader.so
extension=/nix/store/9dd4wdj417n1q0gjvk4jadwzmlhis9pp-php-xmlwriter-7.2.34/lib/php/extensions/xmlwriter.so
extension=/nix/store/39mw3p9931b7v348xd35yc5xhrs1g2cs-php-zip-7.2.34/lib/php/extensions/zip.so
extension=/nix/store/0n0ik9qg9h4akw15kyqsiv9n7vf55sm4-php-zlib-7.2.34/lib/php/extensions/zlib.so
extension=/nix/store/c976n2by320l83ifsw8j90905vxkzsy7-php-imap-7.2.34/lib/php/extensions/imap.so
extension=/nix/store/vdai44aa0w8948pwqqk712agpj4j7vvf-php-oauth-2.0.7/lib/php/extensions/oauth.so
@sandydoo thank you very much, extension worked but seem env not working ( i added dotenv.enable = true;
), i will continue debug, thank you.
Hi everyone, i try to set up with my old php project with devenv like below, but i don't know how to load extension in php.ini. Hope anyone help me 1 solution.