CentOS release 6.7 (centos-release-6-7.el6.centos.12.3.x86_64)
kernel 2.6.32-573.22.1.el6.x86_64
We had successfully built the mongo-php-driver with the instructions found here
Last week I spun up a new instance, patched it via yum update, and tried to build - and I'm consistently getting this error now:
>> make install
Installing shared extensions: /usr/lib64/php/modules/
>> service php-fpm restart
Stopping php-fpm: [ OK ]
Starting php-fpm: [12-Apr-2016 14:38:39] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mongodb.so' - /usr/lib64/php/modules/mongodb.so: undefined symbol: bson_decimal128_from_string in Unknown on line 0
The build returns no errors, and seems to build the bson libraries as it goes:
checking for uint64_t... yes
... seen our uintptr_t in stdint.h (uint64_t too)
creating ./src/libbson/src/bson/bson-stdint.h : ___SRC_LIBBSON_SRC_BSON_BSON_STDINT_H
checking for int_least32_t... yes
checking for int_fast32_t... yes
..adding include stdint.h
... seen good stdint.h inttypes
... seen good uint64_t
... DONE ./src/libbson/src/bson/bson-stdint.h
* snip *
Build configuration:
CFLAGS : -g -O2
Extra CFLAGS : -pthread
Developers flags (slow) :
Code Coverage flags (extra slow) :
System mongoc : no
System libbson : no
LDFLAGS :
EXTRA_LDFLAGS :
MONGODB_SHARED_LIBADD : -lsasl2 -lssl -lcrypto -lrt
So far I have tried (and failed):
Deleting the mongodb.so file, repulling from github, and rebuilding
Descending into the src/libbson directory, building there, then
ascending and building again
Removing any packages containing bson (which include libbson and libbson-devel) using yum, in case it was building agains the wrong lib
My google-fu has failed me, and I can't find anything on SO about it. Anyone hit this kind of issue, or know a fix?
I got this error message when I tried to make an alias for artisan:
[Settings | Tools | Command Line Tool Support ] -> add -> tool based on Symfony Console
Problem
Failed to parse output as xml: Error on line 4: Content is not allowed in prolog..
Command
C:\xampp\php\php.exe C:\xampp\htdocs\laratest\artisan list --xml
Output
[Symfony\Component\Console\Exception\RuntimeException]
The "--xml" option does not exist.
Ok, I know, what's the problem but I don't find any solution for this.
Thank you for the tips!
A temporal modification of the "artisan" file under the Laravel folder will do the trick. (Working on PhpStorm 10.0.3)
if( isset($argv[1]) && $argv[1] == 'list' &&
isset($argv[2]) && $argv[2] == '--xml' ) {
$argv[2] = '--format=xml';
$_SERVER['argv'] = $argv;
}
require __DIR__.'/bootstrap/autoload.php';
Now you can add the "artisan" command line tool support based on Symfony and remove the lines if you wish to.
For everybody affected, this is the commit which removed support for –xml: https://github.com/symfony/console/commit/6d6d9031b9148fed0e2aacb98ac23ce6168ba7ac
Just revert changes in ListCommand.php
it work in 2.7 version
There is no --xml option, you are getting this error when you running this command:
The "--xml" option does not exist.
So what you should do in this case is running:
php artisan help list
and you will get list of all available parameters
and now you will know you need to use:
php artisan list --format=xml
instead of:
php artisan list --xml
EDIT
I've verified it in PhpStorm 10.0.3
as Tool path you can paste in your case:
C:\xampp\php\php.exe C:\xampp\htdocs\laratest\artisan list --format=xml
and it will work
Update composer before add command line tool:
composer update
Problem
I am learning to create a php extension. I have created a php extension for a basic hello world app. But the moment I try to include functions from the C library I am trying to entend then I get the following error message:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/hello.so' - /usr/lib/php5/20121212/hello.so: undefined symbol: nc_open in Unknown on line 0
This nc_open() function is the key function in the libary I am trying to extend
Process
I have created by header and config files and my c extension file which contains:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_hello.h"
#include <netcdf.h>
...
PHP_FUNCTION(hello_world)
{
int status;
int ncid;
status = nc_open("sample.nc", 0, &ncid);
RETURN_LONG(status);
}
I have set up a directory (on Ubuntu) and run the phpize and configure steps. I run the make command which runs with no errors.
In my php.ini file I have the hello.so extension which points to symbolic link to the file I make.
I then restart the apache server on my local machine and then run:
php -r 'echo hello_world();'
and get:
- /usr/lib/php5/20121212/hello.so: undefined symbol: nc_open in Unknown on line 0
PHP Warning: Module 'xdebug' already loaded in Unknown on line 0
PHP Fatal error: Call to undefined function hello_world() in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
The error only occurs when I have a function from netcdf.h
The error does not occur from just having the include statement.
What I've tried:
Firstly I tried writing a basic c program to check that it would work, I managed to succeed by compiling it with:
gcc test.c -lnetcdf -o Test
and running ./Test
I tried using the following MakeFile
LDLIBS = -lnetcdf
but was unsuccessful.
What I would like:
Preferably to know how to get this library to work in my extension but I would settle for being pointed to documents or examples to help me understand what I need to know to accomplish this.
Update
Following Elliott Frisch's comments I have tried the
Setting the PHP_RPATHS=/usr/local
Setting /etc/ld.so.conf to:
include /etc/ld.so.conf.d/*.conf
/usr/lib
Changing the MakeFile to:
LDLIBS = -lnetcdf
LDFLAGS = -static
I am making the assumption that /usr/local is the correct directory due to it containing netcdf.so
I have added the following lines to my config.m4 file according to try adding the suggested functions
PHP_ADD_INCLUDE(/usr/lib)
PHP_ADD_LIBRARY_WITH_PATH(netcdf, /usr/lib, HELLO_SHARED_LIBADD)
Unfortunately I am still getting the problem so I am trying to understand what these functions mean to make sure I using them correctly. (The library I need to connect to is /usr/lib/libnetcdf.a and need to include netcdf.h from that file.)
You'll need to use PHP_ADD_LIBRARY_WITH_PATH & PHP_ADD_INCLUDE macros in config.m4 to handle linking. Autoconf's macros are also helpful for find & verifying existing libraries.
The best examples can be found in the ext directory of PHP's source code. Like ext/zlib
PHP_ADD_LIBPATH($ZLIB_DIR/$PHP_LIBDIR, ZLIB_SHARED_LIBADD)
PHP_ZLIB_DIR=$ZLIB_DIR
PHP_ADD_LIBRARY(z,, ZLIB_SHARED_LIBADD)
PHP_ADD_INCLUDE($ZLIB_INCDIR)
And more detailed examples in ext/oracle (from apple's open source labs)
PHP_ADD_LIBRARY(clntsh, 1, ORACLE_SHARED_LIBADD)
PHP_ADD_LIBPATH($ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
The issue was with an incorrectly configured config.m4 file.
I added the following that I modified from examples I found to get it to work:
if test "$PHP_HELLO" != "no"; then
SEARCH_PATH="/usr/local /usr" # you might want to change this
SEARCH_FOR="/include/netcdf.h" # you most likely want to change this
if test -r $PHP_HELLO/$SEARCH_FOR; then # path given as parameter
HELLO_INC_DIR=$PHP_HELLO/include
else # search default path list
AC_MSG_CHECKING([for netcdf.h in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
HELLO_INC_DIR=$i/include
AC_MSG_RESULT(found in $i)
fi
done
fi
if test -z "$HELLO_INC_DIR"; then
AC_MSG_RESULT([not found])
fi
SEARCH_PATH="/usr/local /usr" # you might want to change this
SEARCH_FOR="/lib/libnetcdf.a" # you most likely want to change this
if test -r $PHP_HELLO/$SEARCH_FOR; then # path given as parameter
HELLO_LIB_DIR=$PHP_HELLO/lib
else # search default path list
AC_MSG_CHECKING([for libnetcdf in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
HELLO_LIB_DIR=$i/lib
AC_MSG_RESULT(found in $i)
fi
done
fi
if test -z "$HELLO_LIB_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please check the netCDF distribution])
fi
# --with-netcdf -> add include path
PHP_ADD_INCLUDE($HELLO_INC_DIR)
# --with-netcdf -> check for lib and symbol presence
LIBNAME=netcdf # you may want to change this
dnl O_LDFLAGS=$LDFLAGS
dnl LDFLAGS="$LDFLAGS -L$NETCDF_LIB_DIR -l$LIBNAME"
PHP_ADD_LIBRARY($LIBNAME)
LIBSYMBOL=nc_inq_libvers # you most likely want to change this
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
[
PHP_ADD_LIBRARY($LIBNAME)
AC_DEFINE(HAVE_HELLO,1,[Build netCDF extension])
],[
AC_MSG_ERROR([wrong netCDF library version or lib not found])
])
PHP_SUBST(HELLO_SHARED_LIBADD)
HELLO_SHARED_LIBADD=-l$LIBNAME
I have downloaded Cake PHP v2.7.0. Now, I need to change the console path for baking. What command should I use to change the console from current v1.3.0 to v2.7.0. I tried with the following commands
app/Console/cake bake
/var/www/project_name/app/Console/cake.php bake
But, still I am not getting updated with the console. I am using ubuntu OS. What command should I try to change the cake console in my system? When I get into the Console folder and execute the command "cake", I get the following warning:
PHP Warning: /usr/share/php/cake/console/templates/skel/tmp/cache/ is not writable in /usr/share/php/cake/libs/cache/file.php on line 281
PHP Stack trace:
PHP 1. {main}() /usr/share/php/cake/console/cake.php:0
PHP 2. ShellDispatcher->ShellDispatcher() /usr/share/php/cake/console/cake.php:664
PHP 3. ShellDispatcher->_initEnvironment() /usr/share/php/cake/console/cake.php:136
PHP 4. ShellDispatcher->__bootstrap() /usr/share/php/cake/console/cake.php:176
PHP 5. include_once() /usr/share/php/cake/console/cake.php:272
PHP 6. Cache->config() /usr/share/php/cake/console/templates/skel/config/core.php:304
PHP 7. Cache->_buildEngine() /usr/share/php/cake/libs/cache.php:141
PHP 8. FileEngine->init() /usr/share/php/cake/libs/cache.php:166
PHP 9. FileEngine->__active() /usr/share/php/cake/libs/cache/file.php:94
PHP 10. trigger_error() /usr/share/php/cake/libs/cache/file.php:281
Warning: /usr/share/php/cake/console/templates/skel/tmp/cache/ is not writable in /usr/share/php/cake/libs/cache/file.php on line 281
Call Stack:
0.0016 380824 1. {main}() /usr/share/php/cake/console/cake.php:0
0.0174 381144 2. ShellDispatcher->ShellDispatcher() /usr/share/php/cake/console/cake.php:664
0.1012 535216 3. ShellDispatcher->_initEnvironment() /usr/share/php/cake/console/cake.php:136
0.1013 538040 4. ShellDispatcher->__bootstrap() /usr/share/php/cake/console/cake.php:176
0.2275 1716776 5. include_once('/usr/share/php/cake/console/templates/skel/config/core.php') /usr/share/php/cake/console/cake.php:272
0.2300 1898096 6. Cache->config() /usr/share/php/cake/console/templates/skel/config/core.php:304
0.2300 1899448 7. Cache->_buildEngine() /usr/share/php/cake/libs/cache.php:141
0.2340 1956656 8. FileEngine->init() /usr/share/php/cake/libs/cache.php:166
0.2347 1959744 9. FileEngine->__active() /usr/share/php/cake/libs/cache/file.php:94
0.2647 2568904 10. trigger_error() /usr/share/php/cake/libs/cache/file.php:281
Welcome to CakePHP v1.3.14 Console
---------------------------------------------------------------
Current Paths:
-app: Console
-working: /var/www/cakelatest/app/Console
-root: /var/www/cakelatest/app
-core: /usr/share/php
Changing Paths:
your working path should be the same as your application path
to change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp
Available Shells:
acl [CORE] i18n [CORE]
api [CORE] schema [CORE]
bake [CORE] testsuite [CORE]
console [CORE]
To run a command, type 'cake shell_name [args]'
To get help on a specific command, type 'cake shell_name help'
what am I missing in here?
PHP Warning: /usr/share/php/cake/console/templates/skel/tmp/cache/ is not writable in /usr/share/php/cake/libs/cache/file.php on line 281
Sounds like a permission Problem to me.
can you print here the output of
ls -la /usr/share/php/cake/console/templates/skel/tmp/cache | grep -e " \.$"
When you open the app in the web, cakephp change the /APP/tmp/ folder, you need run the cake command with the www-data user, you can use this command:
sudo www-data php Console/cake.php bake
I need help on How to: Enable PCNTL in Ubuntu PHP.
$ mkdir /tmp/phpsource
$ cd /tmp/phpsource
$ wget http://museum.php.net/php5/php-5.3.2.tar.gz
$ tar xvf php-5.3.2.tar.gz
$ cd php-5.3.2/ext/pcntl
$ phpize -bash: phpize: command not found
Everything went fine until I tried to run phpize! And then I get the error '-bash: phpize: command not found' ?? Any ideas?
UPDATE ran:
$ sudo apt-get update
and then ran:
$ sudo apt-get install php5-dev
With the help of Nick I managed to finish the procedure. But 'make test' fails???
$ phpize
$ ./configure
$ make
$ cp modules/pcntl.so /usr/lib/php5/20090626/
$ echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini
$ make test - FAILED!
HELP: I typed 'echo "extension=pcntl.so > /etc/php5/conf.d/pcntl.ini' instead of 'echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini' the first time I ran this. Is that BAD?
--------------------------------- Make TEst Error Messages --------------------------------------
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1850 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1852 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1850 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1852 in Unknown on line 0
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0
Warning: Module 'pcntl' already loaded in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1850 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini on line 1852 in Unknown on line 0
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0
Warning: Module 'pcntl' already loaded in Unknown on line 0
=====================================================================
PHP : /usr/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.3.2-1ubuntu4.18
ZEND_VERSION: 2.3.0
PHP_OS : Linux - Linux lvps217-8-253-63.vps.webfusion.co.uk 2.6.32-042stab068.8 #1 SMP Fri Dec 7 17:06:14 MSK 2012 x86_64
INI actual : /tmp/phpsource/php-5.3.2/ext/pcntl/tmp-php.ini
More .INIs :
CWD : /tmp/phpsource/php-5.3.2/ext/pcntl
Extra dirs :
VALGRIND : Not used
=====================================================================
TIME START 2013-01-02 23:05:56
=====================================================================
FAIL Test pcntl wait functionality [tests/001.phpt]
FAIL pcntl: pcntl_sigprocmask(), pcntl_sigwaitinfo(), pcntl_sigtimedwait() [tests/002.phpt]
FAIL pcntl: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK [tests/003.phpt]
FAIL Bug #47566 (return value of pcntl_wexitstatus()) [tests/bug47566.phpt]
FAIL pcntl_alarm() [tests/pcntl_alarm.phpt]
FAIL pcntl_exec() [tests/pcntl_exec.phpt]
FAIL pcntl_exec() 2 [tests/pcntl_exec_2.phpt]
FAIL pcntl_exec() 3 [tests/pcntl_exec_3.phpt]
FAIL Test function pcntl_fork() by calling it with its expected arguments [tests/pcntl_fork_basic.phpt]
FAIL Test function pcntl_fork() by testing the process isolation in the forking hierarchy father -> son -> grandson where father can not knows his grandson [tests/pcntl_fork_variation.phpt]
FAIL pcntl_signal() [tests/pcntl_signal.phpt]
FAIL pcnt_signal_dispatch() [tests/pcntl_signal_dispatch.phpt]
FAIL pcntl_wait() [tests/pcntl_wait.phpt]
FAIL Closures as a signal handler [tests/signal_closure_handler.phpt]
=====================================================================
TIME END 2013-01-02 23:05:59
=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 0
Exts tested : 44
---------------------------------------------------------------------
Number of tests : 14 14
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 14 (100.0%) (100.0%)
Expected fail : 0 ( 0.0%) ( 0.0%)
Tests passed : 0 ( 0.0%) ( 0.0%)
---------------------------------------------------------------------
Time taken : 3 seconds
=====================================================================
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Test pcntl wait functionality [tests/001.phpt]
pcntl: pcntl_sigprocmask(), pcntl_sigwaitinfo(), pcntl_sigtimedwait() [tests/002.phpt]
pcntl: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK [tests/003.phpt]
Bug #47566 (return value of pcntl_wexitstatus()) [tests/bug47566.phpt]
pcntl_alarm() [tests/pcntl_alarm.phpt]
pcntl_exec() [tests/pcntl_exec.phpt]
pcntl_exec() 2 [tests/pcntl_exec_2.phpt]
pcntl_exec() 3 [tests/pcntl_exec_3.phpt]
Test function pcntl_fork() by calling it with its expected arguments [tests/pcntl_fork_basic.phpt]
Test function pcntl_fork() by testing the process isolation in the forking hierarchy father -> son -> grandson where father can not knows his grandson [tests/pcntl_fork_variation.phpt]
pcntl_signal() [tests/pcntl_signal.phpt]
pcnt_signal_dispatch() [tests/pcntl_signal_dispatch.phpt]
pcntl_wait() [tests/pcntl_wait.phpt]
Closures as a signal handler [tests/signal_closure_handler.phpt]
ANY ideas!?!
Carl
Here's what I've found in Ubuntu 12.04:
Check your PHP.ini for the pnctl functions being disabled.
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority
phpinfo reports the function is already loaded but it will not actually work without putting the pcntl.ini file into /etc/php5/conf.d.
Sadly, this causes 'module already loaded' errors every time PHP session cleanup cron in /etc/cron.d kicks off, but PCNTL won't function without both of these pieces in place, and so far I haven't found a good solution to disable the 'already loaded' error. Its messy, and ugly, and spams my root mail, and when I can find a solution, I will post it. I've only run into this problem in 12.04 so far.
UPDATE
I hacked my /usr/lib/php5/maxlifetime script file to stop spamming with pnctl errors (PHP Warning: Module 'pcntl' already loaded in Unknown on line 0). Here are my edits - I specifically added in the 'E_DEPRECATED' line to quiet the messages.
Line 8:
cur=$(php5 -c /etc/php5/${sapi}/php.ini -d "error_reporting='E_ALL & ~E_DEPRECATED'" -r 'print ini_get("session.gc_maxlifetime");' 2> /dev/null)
There is some steps like this:
(my OS is debian7.2 xfce x86).
1: i install pcntl like this
#mkdir php
#cd php
#apt-get source php5
#cd php5-5.4.4/ext/pcntl
#phpize
#./configure
#make
#echo "extension=pcntl.so" > /etc/php5/mods-available/pcntl.ini
#ln -s /etc/php5/mods-available/pcntl.ini /etc/php5/conf.d/pcntl.ini
2: when is restart nginx or apache2, the php get one warning.
"PHP Warning: Module ‘pcntl’ already loaded in Unknown on line 0"
3: so i
"rm -rf /etc/php5/mods-available/pcntl.ini and
/etc/php5/conf.d/pcntl.ini"
4: edit the "php.ini" file .
a.apache2, it's in "/etc/php5/apache2/php.ini"
b.cgi like nginx,it's in "/etc/php5/cgi/php.ini"
make the
"disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited..."
comments, add " ; " in front of "disable_functions".
restart your server and the warning gone.good luck.
On my dev machine with ubuntu 12.10 (and earlier versions too) pcntl is/was already enabled.
$ php -m | grep pcntl
pcntl
I guess thats the problem:
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0
So just don't install it again.
I NEEDED to restart the server! And now it works! Doh.. Thanks for everybodys input.
In Ubuntu 15.04, the pcntl is installed in the php CLI, but disabled by default. To enable, edit /etc/php5/cli/php.ini and comment out the line:
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
If you want these enabled in apache2, then edit the file /etc/php5/apache2/php.ini and make the same change.
It may be advisable to only remove the functions you need to use, in order to preserve as much of the security restrictions as possible.