• Resolved Stephen Dickinson

    (@steved430)


    Hi,

    I am rather new to PHP and WordPress development and I hoping someone can point me in the right direction. I self host my Web Site on a Linux box, but am undertaking the development on a Windows PC running Windows 10 with a WAMP installation.

    In addition I write and test the PHP code in Visual Studio 17. The PHP libraries installed with VS2017 is at version 7.1.19, where the PHP with the WAMP is at version 7.2.4

    I was developing a function to parse the Content using DOMDocument.loadHTML(); Within VS2017 everything is fine. When I load the function into the WAMP installation I am getting the error “Class ‘DOCDocument’ not found”.

    Researching this on the internet seemed to suggest that on Windows I needed a “use \DOMDocument;” instruction. I added this to no effect.

    I checked the list of php extention dlls in the VS2017 7.1/ext directory against those in the WAMP 7.2/ext and the only dll that is in 7.1 and not in 7.2 is php_xdebug.dll.

    I have also checked the list of enabled extensions in WAMP 7.2, and whilst they are not all enabled, they only ones that are not enabled seem to be related to D/B, FTP or Test.

    Can anyone tell me what I need to do get the DOMDocument class loaded on the WAMP?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Joy

    (@joyously)

    The docs say it’s enabled by default.
    https://us1.php.net/manual/en/dom.requirements.php
    But also say

    The DOM extension uses UTF-8 encoding. Use utf8_encode() and utf8_decode() to work with texts in ISO-8859-1 encoding or Iconv for other encodings.

    Stacks like WAMP are not very changeable, in terms of versions. There is no source to rebuild. You can look in the php.ini file to see if there is a list of extensions that can be uncommented.

    If this code is code you want to distribute, consider that others might have this same problem using it.

    Thread Starter Stephen Dickinson

    (@steved430)

    Hi Joy,
    Thanks for getting back. Like you, the issue I have is that the doc says it is enabled by default, which implies I would get a different error than “Class not known” if there were an encoding issue. The error I am getting implies that the library containing the class has not been loaded, and yet as far as I can tell the xml/doc parsing libraries should be available by default with PHP 7. They are there with my VS 2017 env, but not, apparently, with the WAMP installation.

    Further to my initial comments, I have edited the php.ini file to enable all the php extensions, sadly to no effect.

    Dion

    (@diondesigns)

    Since you have the knowledge to self-host, I suggest you get rid of WAMPServer and install the WAMP stack yourself:

    https://downloads.mariadb.org/mariadb/10.1.38/
    https://www.apachelounge.com/download/
    https://windows.php.net/download/

    Select a “thread safe” version of PHP, which is installed via mod_php into Apache. MariaDB and Apache can be installed as services.

    I don’t know whether this will solve your problem (I’m guessing not since I suspect it’s a coding issue), but it will give you much better control over your PHP development environment.

    Thread Starter Stephen Dickinson

    (@steved430)

    Thanks to everyone for getting back. Issue is now solved. It all revolved around namespaces and fully qualified names.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘DOMDocument not found on Windows dev enviroment’ is closed to new replies.