Menu

Example.php fails

Help
Anonymous
2023-01-19
2024-05-17
  • Anonymous

    Anonymous - 2023-01-19

    Hi All,
    I have downloaded and extracted PHPCrawl, and when i run
    php Example.php i get the following output.

    stu@stu:~/Downloads/PHPCrawl/PHPCrawl_083$ php example.php
    PHP Fatal error:  Uncaught Error: Call to undefined function each() in /home/stu/Downloads/PHPCrawl/PHPCrawl_083/libs/UrlCache/PHPCrawlerMemoryURLCache.class.php:25
    Stack trace:
    #0 /home/stu/Downloads/PHPCrawl/PHPCrawl_083/libs/PHPCrawler.class.php(588): PHPCrawlerMemoryURLCache->getNextUrl()
    #1 /home/stu/Downloads/PHPCrawl/PHPCrawl_083/libs/PHPCrawler.class.php(363): PHPCrawler->startChildProcessLoop()
    #2 /home/stu/Downloads/PHPCrawl/PHPCrawl_083/example.php(62): PHPCrawler->go()
    #3 {main}
      thrown in /home/stu/Downloads/PHPCrawl/PHPCrawl_083/libs/UrlCache/PHPCrawlerMemoryURLCache.class.php on line 25
    

    Any help, or someone to tell me what im doing wrong, would be greatly appreciated.

     
  • Anonymous

    Anonymous - 2023-01-19

    What version of PHP are you using?
    https://www.php.net/manual/en/function.each.php

     
    • Anonymous

      Anonymous - 2023-01-20

      PHP 8.1.7-1ubuntu3.1 (cli) (built: Nov 2 2022 13:39:03) (NTS)
      Copyright (c) The PHP Group
      Zend Engine v4.1.7, Copyright (c) Zend Technologies
      with Zend OPcache v8.1.7-1ubuntu3.1, Copyright (c), by Zend Technologies

       
      • Anonymous

        Anonymous - 2023-01-20

        There's your problem.

         
        • Anonymous

          Anonymous - 2023-01-20

          So is it as simple as finding

          each()
          

          and changing each to another function? if so what would the new function be?

           
          • Anonymous

            Anonymous - 2023-01-20

            Maybe, but that's only your first error. Be prepared for other php8 differences that won't work.

             
  • James Shaver

    James Shaver - 2023-01-25

    I have a github repo for phpcrawl that I'm using successfully in PHP8. It's installable by composer, or you can just download and install the package where you want.
    https://github.com/JamesShaver/phpcrawl

     
    • Anonymous

      Anonymous - 2024-05-17

      you the best

       

Anonymous
Anonymous

Add attachments
Cancel