问题
I am trying to create a message queue using the following tutorial;
http://www.ebrueggeman.com/blog/creating-a-message-queue-in-php
The problem I am running in to is that I get the following error;
ErrorException [ Fatal Error ]: Call to undefined function msg_get_queue()
I have found out that this is because my PHP installation is missing some of the Semaphore Functions and I should recompile my PHP installation using the following parameter --enable-sysvmsg.
I am running MAMP on Lion OSX and actually have no clue where to start. I can't find any information on the MAMP forums how to do this or further information about enabling Semaphore Functions for OSX. What is the best way to approach this problem?
回答1:
As you said in your question, you need to compile a php version with Semaphore
enabling.
The steps are:
- Download
PHP
- Execute
./configure
with required --enable-xxx params (list that I used mentioned below). It's not that easy and you might also need to install some brew packages (I needed to installmap-uw
andlibiodbc
). - Execute
make
- Replace
MAMP
version with the new compiled version
./configure
params that I use:
./configure \
--prefix=/Applications/MAMP/bin/php/php5.4.45 \
--exec-prefix=/Applications/MAMP/bin/php/php5.4.45 \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/Applications/MAMP/bin/php/php5.4.45/conf \
--enable-cli \
--with-config-file-path=/Applications/MAMP/bin/php/php5.4.45/conf \
--with-libxml-dir=/Applications/MAMP/Library \
--with-openssl=/Applications/MAMP/Library \
--with-kerberos=/usr \
--with-zlib=/Applications/MAMP/Library \
--with-zlib-dir=/Applications/MAMP/Library \
--enable-bcmath \
--with-bz2=/Applications/MAMP/Library \
--enable-calendar \
--with-curl=/Applications/MAMP/Library \
--enable-dba \
--enable-exif \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-icu-dir=/Applications/MAMP/Library \
--with-iodbc=/Applications/MAMP/Library \
--enable-mbstring=all \
--enable-mbregex \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--without-pear \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/mysql/mysql.sock \
--enable-shmop \
--enable-soap \
--enable-pcntl \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-xmlrpc \
--with-iconv=/Applications/MAMP/Library \
--with-xsl=/Applications/MAMP/Library \
--enable-zip \
--with-kerberos \
--enable-intl \
--with-pcre-regex \
--with-freetype-dir=/Applications/MAMP/Library \
--with-jpeg-dir=/Applications/MAMP/Library \
--with-png-dir=/Applications/MAMP/Library \
--with-t1lib=/Applications/MAMP/Library \
--with-gettext=shared,/Applications/MAMP/Library \
--with-mcrypt=shared,/Applications/MAMP/Library \
--enable-opcache \
--enable-cgi \
--with-libexpat-dir=/Applications/MAMP/Library \
--with-mhash
来源:https://stackoverflow.com/questions/16056316/enable-php-semaphore-functions-on-mamp