Trouble Installing the C Extension for PHP 5.5
I needed to install gRPC for PHP and part of the instructions included installing the Protobuf Runtime Library. I was unable to install the C extension, and got this error message. However, I was successfully able to install the PHP extension.
I have the following version of PHP installed: PHP 5.5.9-1ubuntu4.21
@TeBoring
I created an ubuntu14.04 instance on gce and installed php5.5.9. Our tests ran without error.
Install build tools
sudo apt-get install autoconf automake libtool curl make g++ unzip git
install php
wget http://php.net/get/php-5.5.9.tar.gz/from/this/mirror
mv mirror php-5.5.9.tar.gz
tar -xzvf php-5.5.9.tar.gz
sudo apt-get install libxml2-dev
cd php-5.5.9 && ./configure && make && sudo make install
cd ..
build proto
git clone https://github.com/google/protobuf.git
cd protobuf && ./autogen.sh && ./configure && make
generate test proto
pushd php/tests
mkdir generated
../../src/protoc --php_out=generated proto/test.proto proto/test_include.proto proto/test_no_namespace.proto proto/test_prefix.proto proto/test_php_namespace.proto proto/test_empty_php_namespace.proto
pushd ../../src
./protoc --php_out=../php/tests/generated google/protobuf/empty.proto
./protoc --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto
popd
run test
./test.sh
when run ./test.sh show errors: /home/rock/protobuf/php/ext/google/protobuf/protobuf.h:621: note: previous declaration of ‘MessageLayout’ was here /home/rock/protobuf/php/ext/google/protobuf/protobuf.h:627: error: redefinition of typedef ‘Oneof’ /home/rock/protobuf/php/ext/google/protobuf/protobuf.h:626: note: previous declaration of ‘Oneof’ was here /home/rock/protobuf/php/ext/google/protobuf/protobuf.h:630: error: redefinition of typedef ‘RepeatedField’ /home/rock/protobuf/php/ext/google/protobuf/protobuf.h:629: note: previous declaration of ‘RepeatedField’ was here /home/rock/protobuf/php/ext/google/protobuf/protobuf.h:632: error: redefinition of typedef ‘RepeatedFieldIter’ /home/rock/protobuf/php/ext/google/protobuf/protobuf.h:631: note: previous declaration of ‘RepeatedFieldIter’ was here make: *** [array.lo] Error 1 [root@ADO-02 tests]#