Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 919093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:29:07+00:00 2026-05-15T18:29:07+00:00

I wrote an extension in C++ that uses libtidy, and it runs perfectly under

  • 0

I wrote an extension in C++ that uses libtidy, and it runs perfectly under PHP when I compile PHP --with-tidy.

However, it would be nice to have the extension run on a vanilla PHP. When I try to use the extension, I get something like:

PHP Warning:   
  PHP Startup: 
    Unable to load dynamic library 'extension.so': 
      undefined symbol: tidyCleanAndRepair in Unknown on line 0

and the extension is not loaded.

Obviously, the official tidy extension works fine. I have the relevant libtidy development packages installed on the system, and it compiles+links without a problem. I have tried to look through the code for the tidy extension, but it is a huge mass of macros – copying pieces at random felt like cargo code.

Besides linking to the library with PHP_ADD_LIBRARY_WITH_PATH(tidy, $TIDY_LIBDIR, TIDY_SHARED_LIBADD), Is there a PHP extension or C statement that fixes this error?

Thanks in advance!!

EDIT: here is the entire config.m4 file:

dnl config.m4 for extension htmlparser

PHP_ARG_ENABLE(htmlparse, whether to enable htmlparser support,
 [  --enable-htmlparser           Enable htmlparser support])

if test "$PHP_HTMLPARSER" != "no"; then


  if test -r $PHP_LIBXML2/lib/libxml2.a; then
    LIBXML2_DIR=$PHP_LIBXML2
  else
    AC_MSG_CHECKING(for libxml2 in default path)
    for i in /usr/local /usr; do
      if test -r $i/lib/libxml2.a; then
        LIBXML2_DIR=$i
        AC_MSG_RESULT(found in $i)
      fi
    done
  fi

  if test -z "$LIBXML2_DIR"; then
    AC_MSG_RESULT(not found)
    AC_MSG_ERROR(Please reinstall the libxml2 distribution - libxml2.h should
                 be in <libxml2-dir>/include and libxml2.a should be in <libxml2-    dir>/lib)
  fi
  PHP_ADD_INCLUDE($LIBXML2_DIR/include/libxml2)
  PHP_ADD_LIBRARY_WITH_PATH(libxml2, $LIBXML2_DIR/lib, LIBXML2_SHARED_LIBADD)

  AC_MSG_CHECKING(for boost in default path)
  for i in /usr/local /usr; do
    if test -r $i/include/boost; then
      BOOST_DIR=$i
      AC_MSG_RESULT(found in $i)
    fi
  done

  if test -z "$BOOST_DIR"; then
    AC_MSG_RESULT(not found)
    AC_MSG_ERROR(Please reinstall the boost distribution!!!)
  fi
  PHP_ADD_INCLUDE($BOOST_DIR/include/boost/)


    TIDY_SEARCH_DIRS="/usr/local /usr"
    for i in $TIDY_SEARCH_DIRS; do
        if test -f $i/include/tidy/tidy.h; then
            TIDY_DIR=$i
            TIDY_INCDIR=$i/include/tidy
        elif test -f $i/include/tidy.h; then
            TIDY_DIR=$i
            TIDY_INCDIR=$i/include
        fi
    done


    if test -z "$TIDY_DIR"; then
        AC_MSG_ERROR(Cannot find libtidy)
    fi

  TIDY_LIBDIR=$TIDY_DIR/lib

  PHP_ADD_INCLUDE($TIDY_INCDIR)
  PHP_ADD_LIBRARY_WITH_PATH(tidy, $TIDY_LIBDIR, TIDY_SHARED_LIBADD)

  PHP_CHECK_LIBRARY(tidy,tidyOptGetDoc,
  [
  AC_DEFINE(HAVE_TIDYOPTGETDOC,1,[ ])
  ],[],[])

  AC_DEFINE(HAVE_HTMLPARSER, 1, [Whether you want htmlparser support])
  PHP_SUBST(HTMLPARSER_SHARED_LIBADD)
  PHP_ADD_LIBRARY_WITH_PATH(stdc++, 1, HTMLPARSER_SHARED_LIBADD)
  PHP_REQUIRE_CXX()
  PHP_NEW_EXTENSION(htmlparser, php_htmlparser.cpp parsehtml.cpp StringBuilder.cpp,     $ext_shared)
fi
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:29:08+00:00Added an answer on May 15, 2026 at 6:29 pm

    did you compile your extension with the same php version as a vanilla php? you should use php sources with the same version.
    besides, make sure that in php.ini file you loaded ‘libtidy’ extension before your extension.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote an XPCOM component and an extension that uses it. XPCOM loads arbitrary
I wrote my own cacheEngine for memcached as that's the extension I have installed
I wrote a Python extension in C, and my python program uses that extension.
I'w writing a PHP script that uses Montage, which is an extension of ImageMagick
I'm trying to write a WiX script that uses the firewall extension to WiX,
I'd like to write a gmail extension that would add a button on the
I wrote a Client that uses a Webservice. Works well in a seperate project.
I have an existing project that i'm working on that uses .net membership. We
I have a program written in VB.NET which stops a service that uses file
I have an ASP.NET (C#) application, written with VS 2008, that uses CodeBehind files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.