1

So i'm trying to build PHP 5.5.9 with MongoDB driver 1.5 (i know, we're back in 2014!) but I'm running into an error when I run ./configure :

checking whether to enable MongoDB support... yes
./configure: line 59477: syntax error near unexpected token src/libmongoc/src/common/,'
./configure: line 59477:   PHP_MONGODB_ADD_SOURCES(src/libmongoc/src/common/, $PHP_MONGODB_COMMON_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)'

It's as if there is supposed to be a function PHP_MONGODB_ADD_SOURCES that does not exist in the configure script... How do I fix this?

I'm running this on an AWS Linux AMI (not verson 2) so that I can create a php runtime for use with Lambda functions, and I need the mongodb driver compiled into it.

Here is all the commands i've used when i've ssh'd into a fresh instance:

sudo yum update -y
sudo yum install -y \
   pcre.x86_64 \
   libxml2-devel \
   libmcrypt-devel.x86_64 \
   bzip2-devel.x86_64 \
   libcurl-devel.x86_64 \
   openssl-devel.x86_64 \
   libpng-devel.x86_64 \
   libicu-devel.x86_64 \
   libedit-devel.x86_64 \
   readline-devel.x86_64 \
   git.x86_64 \
   php-devel.x86_64

sudo yum groupinstall "Development Tools"

curl -o php-5.5.9.tar.gz https://www.php.net/distributions/php-5.5.9.tar.gz
tar xvzf php-5.5.9.tar.gz
cd php-5.5.9

#have to install php to get phpize!
sudo ./configure --prefix=/usr \
            --sysconfdir=/etc \
            --with-config-file-path=/etc 
sudo make
sudo make install


git clone https://github.com/mongodb/mongo-php-driver.git
cd mongo-php-driver
git checkout -b v1.5
git submodule update --init
phpize
sudo ./configure
sudo make all
sudo make install

cd ../../
rm configure
./buildconf --force
sudo ./configure --prefix=/usr \
            --sysconfdir=/etc \
            --with-config-file-path=/etc \
            --with-mcrypt \
            --enable-bcmath \
            --with-bz2 \
            --enable-calendar \
            --enable-ctype \
            --with-curl \
            --enable-dba=shared \
            --enable-dom \
            --enable-exif \
            --enable-fileinfo \
            --enable-ftp \
            --with-gd \
            --with-gettext\
            --enable-hash \
            --with-iconv \
            --enable-intl \
            --enable-json \
            --enable-libxml \
            --enable-mbstring \
            --with-mhash \
            --enable-mysqlnd \
            --with-openssl \
            --with-pcre-regex \
            --enable-pdo \
            --with-pdo-mysql \
            --enable-phar \
            --enable-posix \
            --with-readline \
            --enable-session \
            --enable-shmop \
            --enable-simplexml \
            --enable-soap \
            --enable-sockets \
            --enable-sysvmsg \
            --enable-tokenizer \
            --enable-wddx \
            --enable-xml \
            --enable-xmlreader \
            --enable-xmlwriter \
            --enable-opcache \
            --enable-zip \
            --with-zlib \
            --enable-sysvsem \
            --enable-sysvshm \
            --enable-mongodb

Thanks in advance!

1 Answer 1

2
+25

As a quick-and-dirty work-around you could try replacing the missing-dependancy-function "PHP_MONGODB_ADD_SOURCES" with "PHP_ADD_SOURCES" in the file mongo-php-driver/config.m4

Here's the rationale:

  • PHP_MONGODB_ADD_SOURCES is defined in the file: scripts/autotools/m4/php_mongodb.m4
  • All that function does is some input validation and then calls either PHP_ADD_SOURCES or PHP_ADD_SOURCES_X on the same inputs. These functions appear to have sources from other dependencies that may exist.
  • The "_X" version appears to be less common. So simply find-replace PHP_MONGODB_ADD_SOURCES with PHP_ADD_SOURCES in config.m4
Sign up to request clarification or add additional context in comments.

1 Comment

Although this wasn't the solution i used, it did point me into the right direction. What I ended up doing was copying the contents of scripts/autotools/m4/php_mongodb.m4 into the top of config.m4 and it did compile. Now i'll test it and see if it actually worked. Thanksfor the response!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.