3

I'm working on a project with protocol buffers and after i compiled a proto file, i cant seem to include it neither run it cos it keeps giving me this exact error: PHP Fatal error: Class 'Google\Protobuf\Internal\Message' not found in /app/generated_files/message.php on line 13

On message.php i have the auto generated file from a .proto file and it includes Google\Protobuf\Internal\Message.

While reading on the protobuf github issues, i found that a person had the same problem where he concluded that it was the composer's fault. However in my case that wouldnt be the issue cos i didnt use composer.

I used pecl to install protocol buffers, and i have the library protobuf.so located in /etc/php5/apache2/XXXXXXXXX. I also added extension=protobuf.so on the last line of php.ini.

Keep in mind that im using docker for everything, therefore it might be something different but i still doubt.

Fisnik Hajredini
  • 111
  • 5
  • 13

2 Answers2

1

In case anyone ends up here with the same question: you just need to add componser autoloader to your file include_once './vendor/autoload.php'; (change path as required)

gvf
  • 1,039
  • 7
  • 6
0

I had the same problem, but the reason was different for me: Git somehow messed up the casing of the folders, which lead to a wrong file path translation. As soon as I fixed the casing ([...]/src/Google/Protobuf instead of [...]/src/google/protobuf in the vendor folder)

JFFIGK
  • 632
  • 1
  • 7
  • 24