skip to Main Content

Good evening,

In order to program a PHP application using the Model-View-Controller architecture on Ubuntu 22.04, I first learned to create a vendor folder. Inside this folder, there’s another folder named composer, and within that, the ClassLoader class, two methods (acpu_fetch and apcu_add), and a variable ($hit) are not recognized. The php8.1-acpu package is properly installed. This package is listed when running php -m.
Attached to this message, you will find the ‘phpinfo.php’ file.
Thanks for your help! phpinfo.php

I uninstalled the apcu package and then reinstalled it. I tried the same program on Linux Mint and encountered the same problem.
/etc/php/8.1/mods-available/apcu.ini contains

extension=apcu.so

2

Answers


  1. Chosen as BEST ANSWER

    This is a portion of the program which poses problem: '''

    /**
         * Finds the path to the file where the class is defined.
         *
         * @param string $class The name of the class
         *
         * @return string|false The path if found, false otherwise
         */
        public function findFile($class)
        {
            // class map lookup
            if (isset($this->classMap[$class])) {
                return $this->classMap[$class];
            }
            if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
                return false;
            }
            if (null !== $this->apcuPrefix) {
                $file = apcu_fetch($this->apcuPrefix.$class, $hit);
                if ($hit) {
                    return $file;
                }
            }
    
            $file = $this->findFileWithExtension($class, '.php');
    
            // Search for Hack files if we are running on HHVM
            if (false === $file && defined('HHVM_VERSION')) {
                $file = $this->findFileWithExtension($class, '.hh');
            }
    
            if (null !== $this->apcuPrefix) {
                apcu_add($this->apcuPrefix.$class, $file);
            }
    
            if (false === $file) {
                // Remember that this class does not exist.
                $this->missingClasses[$class] = true;
            }
    
            return $file;
        }
    '''
    If you want the complete class, ask me
        
    

  2. I am testing this program with VSCodium and VSCode. When I disable the "PHP Intelephense" extension, the four errors disappear. Is there a setting to adjust to keep PHP Intelephense? How does PHP IntelliSense compare to PHP Intelephense?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search