Getting Fatal error: Class 'ProtobufMessage' not found in /home/ashwinn/public_html/php-protobuf/example/pb_proto_foo.php on line 10 when trying to execute from browser
ashwinnasare opened this issue · comments
Module is not loaded automatically by your php installation.
Thanks for your response. I have already included Protobuf.so in php.ini. So it should be executable from browser also ,right??
Make sure you edited the right php.ini file (not just one for CLI interface).
I have edited /etc/php.ini from server.
How can I verify whether I have edited the correct php.ini?using phpinfo?
Yeap, phpinfo() function should provide you with this information.
I'm getting the same problem. phpinfo reports that file /etc/php/7.2/cli/conf.d/20-protobuf.ini
was loaded and the file contains extensions=protobuf.so
. But still I'm getting Fatal error: Class 'ProtobufMessage' not found
. php -m
does not contain protobuf either. Why?
@enumag make sure you placed protobuf.so
in a directory where PHP looks up for extensions. You can find this directory by running command:
$ php-config --extension-dir
@hjagodzinski Yes, protobuf.so
is indeed in php-config --extension-dir
. But it still isn't in php -m
. I have no idea what I might have missed.
➜ ~ php -i | grep protobuf
/etc/php/7.2/cli/conf.d/20-protobuf.ini,
➜ ~ cat /etc/php/7.2/cli/conf.d/20-protobuf.ini
extensions=protobuf.so
➜ ~ php-config --extension-dir
/usr/lib/php/20170718
➜ ~ cd /usr/lib/php/20170718
➜ 20170718 ls
apc.so exif.so memprof.so protobuf.so wddx.so
apcu.so fileinfo.so mysqli.so readline.so xdebug.so
bcmath.so ftp.so mysqlnd.so shmop.so xmlreader.so
blackfire.so gd.so opcache.so simplexml.so xml.so
build gettext.so pdo_mysql.so sockets.so xmlwriter.so
calendar.so iconv.so pdo_pgsql.so swoole.so xsl.so
ctype.so inotify.so pdo.so sysvmsg.so zip.so
curl.so intl.so pgsql.so sysvsem.so
dom.so json.so phar.so sysvshm.so
ds.so mbstring.so posix.so tokenizer.so
➜ 20170718 php -m | grep protobuf
➜ 20170718
I'm using Ubuntu 18.04.
... Ok I found the problem. My protobuf.ini contained extensions=protobuf.so
instead of extension=protobuf.so
.