Php for Unleashed board

Hi All,
i have Sifive hifive unleashed board, i followed https://github.com/sifive/meta-sifive
I could able to build demo-coreip-cli using below command:

MACHINE=freedom-u540 bitbake demo-coreip-cli.

i could able to boot successfully.
now i have some Php code, so i tried build Php using “bitbake php”
i got compilation error.

ERROR: php-7.3.8-r0 do_compile: oe_runmake failed

| /home/riscv/riscv-sifive/build/tmp-glibc/work/riscv64-oe-linux/php/7.3.8-r0/php-7.3.8/ext/pcre/pcre2lib/pcre2_jit_compile.c:81:2: error: #error Unsupported architecture
| 81 | #error Unsupported architecture
| | ^~~~~

Please let me know, if anyone tried to run PHP code.

Looks like pcre maybe hasn’t been ported to RISC-V yet. Try building php without that extension.

Hi,

Use the latest php recipe i.e 7.3.11, you are using 7.3.8, where it is calling pcre which uses sljit, which is not ported to riscv.

You can disable the pcre in 7.3.8 recipe.
Better use the latest php recipe 7.3.11, It’s working for me.

1 Like

thanks, As of now i am using “–without-pcre-jit” with 7.3.8 recipe.

Php is working fine. i will try latest php recipe 7.3.11.

one more query:
i am building Php with apache2 extension, libphp7.so is compiled, but not installed to final rootfs any idea.

Thanks,
Praveen

I am using 7.3.11, I have added the bolded line to the .bb file

if ${@bb.utils.contains(‘PACKAGECONFIG’, ‘apache2’, ‘true’, ‘false’, d)}; then
install -d ${D}${sysconfdir}/apache2/modules.d
install -d ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}
install -m 755 libs/libphp${PHP_MAJOR_VERSION}.so ${D}${libdir}/apache2/modules

Add the following lines to the local.conf file
PACKAGECONFIG_pn-php = " apache2"
IMAGE_INSTALL_append = " apache2 php php-cli php-modphp"

You’ll find libphp7.so in /usr/lib/apache2/

Hope this helps.

Hi Thanks a lot.
i added even this line
install -d ${D}${libdir}/apache2/modules/

then it worked.