PHP 错误:libphp5.so:未定义符号:_estrndup

发布于 2024-08-23 21:56:48 字数 1383 浏览 6 评论 0原文

我手动编译 Apache-MySQL-PHP,以使用下面的配置选项构建自定义安装。当我启动 apache 时,它​​无法启动并在 error_log 中添加以下错误。
*阿帕奇2
* MySQL 5.0
* PHP 5.1
* CentOS Linux 5.4 * GCC编译器

在apache日志httpd中出现错误

:/opt/clamp/etc/httpd.conf第54行语法错误:无法将/opt/clamp/modules/libphp5.so加载到服务器:/opt/clamp/modules/libphp5 .so:未定义符号:_estrndup

./configure 选项

APACHE ./配置\ --prefix=/opt/clamp \ --sysconfdir=/opt/clamp/etc \ --enable-auth-dbm \ --enable-cern-meta \ --enable-auth-digest \ --enable-charset-lite \ --enable-deflate \ --启用-过期 \ --启用缓存\ --启用磁盘缓存\ --启用文件缓存\ --启用标头 \ --启用信息 \ --enable-mime-magic \ --启用代理 \ --启用代理-ajp \ --启用代理平衡器 \ --启用代理连接 \ --启用代理FTP \ --启用代理-http \ --启用重写 \ --enable-so \ --enable-ssl

MYSQL ./配置\ --prefix=/opt/clamp \ --sysconfdir=/opt/clamp/etc \ --libexecdir=/opt/clamp/sbin \ --localstatedir=/opt/clamp/var \ --with-unix-socket-path=/opt/clamp/tmp/mysql.sock \ --启用线程安全

PHP ./配置\ --prefix=/opt/clamp \ --sysconfdir=/opt/clamp/etc \ --with-apxs2=/opt/clamp/bin/apxs \ --with-config-file-path=/opt/clamp/etc/php.conf \ --with-mysql=/opt/clamp \ --with-mysqli=/opt/clamp/bin/mysql_config \ --enable-force-cgi-redirect \ --禁用-cgi \ --with-zlib \ --with-gettext \ --with-gdbm \ --with-ldap \ --with-ldap-sasl \ --启用-zip \ --with-bz2 \ --with-gd \ --with-jpeg-dir=/usr \ --with-png-dir=/usr

I compile Apache-MySQL-PHP by hand to build a custom install using the configure options from below. When I start apache it fails to start and adds the below error in the error_log.
* Apache 2
* Mysql 5.0
* PHP 5.1
* CentOS Linux 5.4
* GCC compiler

the error in apache log

httpd: Syntax error on line 54 of /opt/clamp/etc/httpd.conf: Cannot load /opt/clamp/modules/libphp5.so into server: /opt/clamp/modules/libphp5.so: undefined symbol: _estrndup

the ./configure options

APACHE
./configure \
--prefix=/opt/clamp \
--sysconfdir=/opt/clamp/etc \
--enable-auth-dbm \
--enable-cern-meta \
--enable-auth-digest \
--enable-charset-lite \
--enable-deflate \
--enable-expires \
--enable-cache \
--enable-disk-cache \
--enable-file-cache \
--enable-headers \
--enable-info \
--enable-mime-magic \
--enable-proxy \
--enable-proxy-ajp \
--enable-proxy-balancer \
--enable-proxy-connect \
--enable-proxy-ftp \
--enable-proxy-http \
--enable-rewrite \
--enable-so \
--enable-ssl

MYSQL
./configure \
--prefix=/opt/clamp \
--sysconfdir=/opt/clamp/etc \
--libexecdir=/opt/clamp/sbin \
--localstatedir=/opt/clamp/var \
--with-unix-socket-path=/opt/clamp/tmp/mysql.sock \
--enable-thread-safe

PHP
./configure \
--prefix=/opt/clamp \
--sysconfdir=/opt/clamp/etc \
--with-apxs2=/opt/clamp/bin/apxs \
--with-config-file-path=/opt/clamp/etc/php.conf \
--with-mysql=/opt/clamp \
--with-mysqli=/opt/clamp/bin/mysql_config \
--enable-force-cgi-redirect \
--disable-cgi \
--with-zlib \
--with-gettext \
--with-gdbm \
--with-ldap \
--with-ldap-sasl \
--enable-zip \
--with-bz2 \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

临走之时 2024-08-30 21:56:48

如果您不想阅读所有错误日志,您可以尝试:

char *
estrndup(const char *s, size_t len)
{
    char *d = strndup(s, len);
    //if (d == NULL)
    //  (*efunc)(1, "Cannot copy string");
    return d;
}

if you are not gonna read all the error logs, you can try:

char *
estrndup(const char *s, size_t len)
{
    char *d = strndup(s, len);
    //if (d == NULL)
    //  (*efunc)(1, "Cannot copy string");
    return d;
}
各自安好 2024-08-30 21:56:48

看来我没有正确构建 PHP 的 GD 库,使用以下选项构建 PHP 有效(不再有错误):

cd php-5.2.13/
./配置\
--prefix=/opt/clamp \
--sysconfdir=/opt/clamp/etc \
--with-apxs2=/opt/clamp/bin/apxs \
--with-config-file-path=/opt/clamp/etc/php.conf \
--禁用调试\
--with-pic \
--禁用-rpath \
--无梨\
--with-bz2 \
--with-curl \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--启用-gd-native-ttf \
--没有-gdbm \
--with-gettext \
--with-gmp \
--with-iconv \
--with-jpeg-dir=/usr \
--with-openssl \
--with-pspell \
--with-zlib \
--with-layout=GNU \
--启用-exif \
--启用 ftp \
--启用魔术引号 \
--启用套接字\
--enable-sysvsem --enable-sysvshm --enable-sysvmsg \
--启用-wddx \
--with-kerberos \
--enable-ucd-snmp-hack \
--enable-shmop \
--启用日历 \
--没有-sqlite \
--enable-force-cgi-redirect \
--enable-pcntl \
--with-imap --with-imap-ssl \
--启用-mbstring \
--启用-mbregex \
--with-ncurses \
--with-gd \
--enable-bcmath \
--with-xmlrpc \
--with-ldap --with-ldap-sasl \
--with-mysql=/opt/clamp \
--with-mysqli=/opt/clamp/bin/mysql_config \
--enable-dom \
--with-pgsql \
--启用肥皂\
--enable-xmlreader --enable-xmlwriter \
--启用fastcgi
制作
进行安装

It seems that I wasn't building PHP's GD library right, building PHP with the following options worked (no more error):

cd php-5.2.13/
./configure \
--prefix=/opt/clamp \
--sysconfdir=/opt/clamp/etc \
--with-apxs2=/opt/clamp/bin/apxs \
--with-config-file-path=/opt/clamp/etc/php.conf \
--disable-debug \
--with-pic \
--disable-rpath \
--without-pear \
--with-bz2 \
--with-curl \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--without-gdbm \
--with-gettext \
--with-gmp \
--with-iconv \
--with-jpeg-dir=/usr \
--with-openssl \
--with-pspell \
--with-zlib \
--with-layout=GNU \
--enable-exif \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-sysvsem --enable-sysvshm --enable-sysvmsg \
--enable-wddx \
--with-kerberos \
--enable-ucd-snmp-hack \
--enable-shmop \
--enable-calendar \
--without-sqlite \
--enable-force-cgi-redirect \
--enable-pcntl \
--with-imap --with-imap-ssl \
--enable-mbstring \
--enable-mbregex \
--with-ncurses \
--with-gd \
--enable-bcmath \
--with-xmlrpc \
--with-ldap --with-ldap-sasl \
--with-mysql=/opt/clamp \
--with-mysqli=/opt/clamp/bin/mysql_config \
--enable-dom \
--with-pgsql \
--enable-soap \
--enable-xmlreader --enable-xmlwriter \
--enable-fastcgi
make
make install

日久见人心 2024-08-30 21:56:48

这意味着你的 php 构建不正确,可能是因为你已经成功了好几次了,就像我一样,而且只是最后一次你成功了。在这些构建时间之间,您一路安装了一些支持包,而您在开始时忘记了这样做。因此,如果没有 make clean,你最终会得到一些不干净的东西。
Apache 太挑剔了,无法做到这一点。所以最好的尝试是再次运行“make clean”并重建 php 以查看到底发生了什么。

It means you haven't got your php build correctly, probably because you have make it several times, like I did, and only the last time you got through. Between these times of builds you have installed some supporting packages along the way, which you forgot to do at the beginning. Therefore you without make clean you end up with something that is not clean.
And Apache is just too picky to do it. So the best try is to run 'make clean' again and rebuild php to see what really happend.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文