Search code examples
phpapacheyoctobitbakeopenembedded

Apache with PHP support under Yocto Project


I am trying to install apache2 with PHP support on Linux created with the Yocto Project. Unfortunately there is only the PHP recipe and no extra package for the webserver. I figured out there are different ways to include PHP. The "module-way" should be the easiest one I guess.

According to this question (I have not enough reputations to comment) I have to change the php.inc.

Bitbake worked fine and I build my image successfully. But how can I "activate" these module? What files should I edit in which way since there is no PHP support out of the box.


Solution

  • php.inc has apache2 as configuration; to enable, simply add this to your local.conf

    PACKAGECONFIG_append_pn-php = " apache2 " 
    
    PACKAGECONFIG ??= "mysql sqlite3 imap \
                       ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \
    "
    PACKAGECONFIG_class-native = ""
    
    PACKAGECONFIG[mysql] = "--with-mysql=${STAGING_DIR_TARGET}${prefix} \
                            --with-mysqli=${STAGING_BINDIR_CROSS}/mysql_config \
                            --with-pdo-mysql=${STAGING_BINDIR_CROSS}/mysql_config \
                            ,--without-mysql --without-mysqli --without-pdo-mysql \
                            ,mysql5"
    
    PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \
                              --with-pdo-sqlite=${STAGING_LIBDIR}/.. \
                              , \
                              ,sqlite3"
    PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,postgresql"
    PACKAGECONFIG[soap] = "--enable-libxml --enable-soap, --disable-soap, libxml2"
    PACKAGECONFIG[apache2] = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs,,apache2-native apache2"
    PACKAGECONFIG[pam] = ",,libpam"
    PACKAGECONFIG[imap] = "--with-imap=${STAGING_DIR_HOST} \
                           --with-imap-ssl=${STAGING_DIR_HOST} \
                           ,--without-imap --without-imap-ssl \
                           ,uw-imap"
    PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"