Swoole sending check_worker_exit_status() log - php

I have a problem while using laravel with swoole on php 8.1.Some requests finished with HTTP 408 sometimes. Then when I looked at the log file, I saw the following error.
[2022-07-29 08:59:52 $28.0] WARNING Server::check_worker_exit_status(): worker(pid=49, id=4) abnormal exit, status=0, signal=9
then I watched all the processes with "strace" command. I saw the worker killed by manager process. Logs are bellow:
ps -aux
www 54 0.0 0.9 473088 39424 ? Sl 12:40 0:00 swoole_http_server: master process
www 65 0.0 0.5 401440 21036 ? S 12:40 0:00 swoole_http_server: manager process
www 1608 0.2 1.3 427668 52384 ? S 13:19 0:00 swoole_http_server: worker process
strace.log:
54 13:27:40.909415 kill(1608, 0) = 0
54 13:27:40.909598 kill(1608, SIGKILL) = 0
1608 13:27:40.943992 +++ killed by SIGKILL +++
65 13:27:40.944275 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=1608, si_uid=1111, si_status=SIGKILL, si_utime=3840, si_stime=1000} ---
65 13:27:40.944400 rt_sigreturn({mask=[]}) = 1608
I tryed a lot of things but not fixed this problem. How can i deal it?
php -v:
PHP 8.1.8 (cli) (built: Jul 11 2022 08:30:39) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.8, Copyright (c) Zend Technologies
with Zend OPcache v8.1.8, Copyright (c), by Zend Technologies
php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <team#swoole.com>
Version => 4.8.10
Built => Jul 6 2022 13:14:29
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 3.0.2 15 Mar 2022
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
php artisan --version
Laravel Framework 9.21.3
uname -a
Linux 9968d896fe6c 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
gcc -v
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.2.0-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1)

Related

PHP only loading opcode cache in CLI and not for page served by Apache

I'm trying to enable opcode cache for PHP and make sure that its working for served pages. I'm currently running an Apache 2.4.52 server on an Amazon EC2 instance. I know for sure that opcode cache is installed, and I have a file 10-opcache.ini in php.d, which is where all other ini files are read from. The problem is that 10-opcache.ini doesn't seem to be getting read when I call phpinfo() in a served page, but it is being read when I call phpinfo() in the command line.
Here is my output for the first section of phpinfo() ran through the command line:
Interactive shell
php > phpinfo();
phpinfo()
PHP Version => 7.2.34
System => Linux ip-172-31-84-175.ec2.internal 5.10.82-83.359.amzn2.x86_64 #1 SMP Tue Nov 30 20:47:14 UTC 2021 x86_64
Build Date => Oct 21 2020 18:03:14
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /etc/php.d
Additional .ini files parsed => /etc/php.d/10-opcache.ini,
/etc/php.d/20-bz2.ini,
/etc/php.d/20-calendar.ini,
/etc/php.d/20-ctype.ini,
/etc/php.d/20-exif.ini,
/etc/php.d/20-fileinfo.ini,
/etc/php.d/20-ftp.ini,
/etc/php.d/20-gettext.ini,
/etc/php.d/20-iconv.ini,
/etc/php.d/20-json.ini,
/etc/php.d/20-mbstring.ini,
/etc/php.d/20-mysqlnd.ini,
/etc/php.d/20-pdo.ini,
/etc/php.d/20-phar.ini,
/etc/php.d/20-sockets.ini,
/etc/php.d/20-sqlite3.ini,
/etc/php.d/20-tokenizer.ini,
/etc/php.d/20-zip.ini,
/etc/php.d/25-curl.ini,
/etc/php.d/30-mysqli.ini,
/etc/php.d/30-pdo_mysql.ini,
/etc/php.d/30-pdo_sqlite.ini
PHP API => 20170718
PHP Extension => 20170718
Zend Extension => 320170718
Zend Extension Build => API320170718,NTS
PHP Extension Build => API20170718,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => enabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => available, disabled
Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, compress.bzip2, phar, zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters => zlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, bzip2.*, convert.iconv.*
This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.34, Copyright (c) 1999-2018, by Zend Technologies
phpinfo() command line section for Zend opcache
Opcode Caching => Up and Running
Optimization => Enabled
SHM Cache => Enabled
File Cache => Disabled
Startup => OK
Shared memory model => mmap
Cache hits => 0
Cache misses => 0
Used memory => 18272040
Free memory => 115945688
Wasted memory => 0
Interned Strings Used memory => 197992
Interned Strings Free memory => 8190616
Cached scripts => 0
Cached keys => 0
Max keys => 7963
OOM restarts => 0
Hash keys restarts => 0
Manual restarts => 0
Directive => Local Value => Master Value
opcache.blacklist_filename => /etc/php.d/opcache*.blacklist => /etc/php.d/opcache*.blacklist
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => On => On
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.file_cache => no value => no value
opcache.file_cache_consistency_checks => 1 => 1
opcache.file_cache_only => 0 => 0
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.huge_code_pages => On => On
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 8 => 8
opcache.lockfile_path => /tmp => /tmp
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 4000 => 4000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 128 => 128
opcache.opt_debug_level => 0 => 0
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 2 => 2
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_permission => Off => Off
opcache.validate_root => Off => Off
opcache.validate_timestamps => On => On
Here are my basic configuration settings for opcode cache in 10-opcache.ini
; Enable Zend OPcache extension module
zend_extension=opcache
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=128
; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=8
; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
opcache.max_accelerated_files=4000
; The maximum percentage of "wasted" memory until a restart is scheduled.
;opcache.max_wasted_percentage=5
; When this directive is enabled, the OPcache appends the current working
; directory to the script key, thus eliminating possible collisions between
; files with the same name (basename). Disabling the directive improves
; performance, but may break existing applications.
opcache.use_cwd=1
Here is what happens when I call phpinfo() in a served page:
phpinfo page
Here's a list of the parsed .ini files if you don't want to look at the screenshot.
/etc/php.d/20-bz2.ini, /etc/php.d/20-calendar.ini, /etc/php.d/20-ctype.ini, /etc/php.d/20-exif.ini, /etc/php.d/20-fileinfo.ini, /etc/php.d/20-ftp.ini, /etc/php.d/20-gettext.ini, /etc/php.d/20-iconv.ini, /etc/php.d/20-json.ini, /etc/php.d/20-mbstring.ini, /etc/php.d/20-mysqlnd.ini, /etc/php.d/20-pdo.ini, /etc/php.d/20-phar.ini, /etc/php.d/20-sockets.ini, /etc/php.d/20-sqlite3.ini, /etc/php.d/20-tokenizer.ini, /etc/php.d/20-zip.ini, /etc/php.d/25-curl.ini, /etc/php.d/30-mysqli.ini, /etc/php.d/30-pdo_mysql.ini, /etc/php.d/30-pdo_sqlite.ini
The 10-opcache.ini isn't appearing on the list of parsed files. So I'm worried that opcache isn't working correctly. Looking at other posts related to this topic, 10-opcache.ini should be appearing in served pages.

PHP8 + Oracle OCI8 => Fatal error: Uncaught Error: Call to undefined function oci_connect()

I have to upgrade an old running and functional app that uses PHP 5.3 32bit, Apache2.2 32bit, Oracle client 11.2 32bit running on Windows 64bit (Win10 for dev, and server for prod).
The new stack is Apache2.4 32bit, PHP8 32bit and the exact same Oracle client 11.2 32bit.
And when I run the webapp, I've got this error at the first DB connection attempt :
Fatal error: Uncaught Error: Call to undefined function oci_connect() in c:\some\path\connexion_check.php:16 Stack trace: #0 {main} thrown in c:\some\path\connexion_check.php on line 16
My installation was done using these packages :
httpd-2.4.48-win32-VS16.zip
php-8.0.8-Win32-vs16-x86.zip
php_oci8-3.0.1-8.0-ts-vs16-x86.zip
php-debug-pack-8.0.8-Win32-vs16-x86.zip
In my PHP.ini file, I have set
extension_dir = "ext"
extension=oci8_11g
There, I use the same parameter as with PHP5.3 => extension=oci8_11g
but the DLL was updated with the package php_oci8-3.0.1-8.0-ts-vs16-x86.zip
Running the command php --ri oci8 says
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 3.0.1
Oracle Run-time Client Library Version => 11.2.0.3.0
Oracle Compile-time Instant Client Version => 11.2
Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off
Statistics =>
Active Persistent Connections => 0
Active Connections => 0
Some PHPINFO (from CLI)
phpinfo()
PHP Version => 8.0.8
System => Windows NT D20899 10.0 build 19042 (Windows 10) i586
Build Date => Jun 29 2021 15:54:30
Build System => Microsoft Windows Server 2019 Datacenter [10.0.17763]
Compiler => Visual C++ 2019
Architecture => x86
Configure Command => cscript /nologo /e:jscript configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=..\..\..\..\instantclient\sdk,shared" "--with-oci8-19=..\..\..\..\instantclient\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--without-analyzer" "--with-pgo"
Server API => Command Line Interface
Virtual Directory Support => enabled
Configuration File (php.ini) Path =>
Loaded Configuration File => C:\www\php8\php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20200930
PHP Extension => 20200930
Zend Extension => 420200930
Zend Extension Build => API420200930,TS,VS16
PHP Extension Build => API20200930,TS,VS16
Debug Build => no
Thread Safety => enabled
Thread API => Windows Threads
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
DTrace Support => disabled
Registered PHP Streams => php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar
Registered Stream Socket Transports => tcp, udp, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters => convert.iconv.*, string.rot13, string.toupper, string.tolower, convert.*, consumed, dechunk, zlib.*, bzip2.*
This program makes use of the Zend Scripting Language Engine:
Zend Engine v4.0.8, Copyright (c) Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
Besides this webapp, I manage/use other apps/tools that connect to my Oracle DB using that same InstantClient installation. DB connections are ok from this computer using :
Oracle tools
Powerbuilder 32bit
Python 32bit + cx_Oracle
Microsoft Word through Oracle Data Provider for .NET and OLEDB
I've checked a lot of things but can't figure out what's wrong.
Thanks for your help :-)
Edited :
C:\www\php8>php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
filter
hash
iconv
json
libxml
mysqlnd
oci8
openssl
pcre
PDO
Phar
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
xdebug
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
Xdebug
Hell, I got it.
Here's the explanation for the next guy who'll come with the same problem...
Here's some data about my settings :
C:\WWW\
C:\WWW\Apache24
C:\WWW\PHP8
C:\WWW\PHP8\php.exe
C:\WWW\PHP8\php.ini
C:\WWW\PHP8\ext
C:\WWW\PHP8\ext\oci8_11g.dll
C:\WWW\MyWebApp\index.php
it seemed odd that the extension oci8 didn't come out from phpinfo().
Using Process Monitor i figured out that oci8_11g.dll was searched everywhere (according to PATH env. variable) but not at the right place.
My setting in PHP.INI was this :
extension_dir = ".\ext"
and ProcMon showed that C:\WWW\PHP8\ext was NOT searched into, but rather C:\WWW\Apache24\ext.
Thus I understood that the folder .\ext was relative to the Apache httpd.exe process running from C:\WWW\Apache24\bin
So, in my PHP.ini file I changed my value to a absolute path so that it will be compatible in the CLI environnement as well as PHP launched from Apache.
extension_dir = "c:\www\php8\ext"
After restarting the Apache service, all is fine.

Local variables not shown when OPcache is enabled while debugging with Xdebug

I have Xdebug enabled and working together with OPcache. OPcache module is loaded first by phpfpm (important). If you try to debug the code below (from the browser) and put a breakpoing in the local variables you will see that they are not displayed. If I deactivate OPCache everything works as expected. I'm using PhpStorm 2018.2.5 to debug.
class Foo {
public $member = 'Some value';
public function methodFoo() {
$localFoo = "local2";
}
}
class Bar {
public $firstMember = "foo";
public $secondMember = "bar";
public function create() {
$localBar = 10;
$newFoo = new Foo();
$newFoo->methodFoo();
$localBar += 1;
$this->firstMember = "Other value";
}
}
$foo = "testing";
$bar = "testing2";
$obj = new Bar();
$obj->create();
I do not know if I miss something or it's a bug. Years ago there was a similar bug in xdebug but it was not related to OPcache:
bug
I leave the information related to my system and the log of Xdebug
phpinfo()
PHP Version => 7.2.10-0ubuntu0.18.04.1
System => Linux pablo-dv6 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64
Build Date => Sep 13 2018 13:45:02
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php/7.2/cli
Loaded Configuration File => /etc/php/7.2/cli/php.ini
Scan this dir for additional .ini files => /etc/php/7.2/cli/conf.d
Additional .ini files parsed => /etc/php/7.2/cli/conf.d/10-opcache.ini,
/etc/php/7.2/cli/conf.d/10-pdo.ini,
/etc/php/7.2/cli/conf.d/15-xml.ini,
/etc/php/7.2/cli/conf.d/20-calendar.ini,
/etc/php/7.2/cli/conf.d/20-ctype.ini,
/etc/php/7.2/cli/conf.d/20-curl.ini,
/etc/php/7.2/cli/conf.d/20-dom.ini,
/etc/php/7.2/cli/conf.d/20-exif.ini,
/etc/php/7.2/cli/conf.d/20-fileinfo.ini,
/etc/php/7.2/cli/conf.d/20-ftp.ini,
/etc/php/7.2/cli/conf.d/20-gettext.ini,
/etc/php/7.2/cli/conf.d/20-iconv.ini,
/etc/php/7.2/cli/conf.d/20-intl.ini,
/etc/php/7.2/cli/conf.d/20-json.ini,
/etc/php/7.2/cli/conf.d/20-mbstring.ini,
/etc/php/7.2/cli/conf.d/20-pdo_sqlite.ini,
/etc/php/7.2/cli/conf.d/20-phar.ini,
/etc/php/7.2/cli/conf.d/20-posix.ini,
/etc/php/7.2/cli/conf.d/20-readline.ini,
/etc/php/7.2/cli/conf.d/20-shmop.ini,
/etc/php/7.2/cli/conf.d/20-simplexml.ini,
/etc/php/7.2/cli/conf.d/20-sockets.ini,
/etc/php/7.2/cli/conf.d/20-sqlite3.ini,
/etc/php/7.2/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.2/cli/conf.d/20-sysvsem.ini,
/etc/php/7.2/cli/conf.d/20-sysvshm.ini,
/etc/php/7.2/cli/conf.d/20-tokenizer.ini,
/etc/php/7.2/cli/conf.d/20-wddx.ini,
/etc/php/7.2/cli/conf.d/20-xmlreader.ini,
/etc/php/7.2/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.2/cli/conf.d/20-xsl.ini,
/etc/php/7.2/cli/conf.d/20-zip.ini,
/etc/php/7.2/cli/conf.d/30-xdebug.ini
PHP API => 20170718
PHP Extension => 20170718
Zend Extension => 320170718
Zend Extension Build => API320170718,NTS
PHP Extension Build => API20170718,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => enabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => available, disabled
Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters => zlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, convert.iconv.*
This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans
Zend OPcache
Opcode Caching => Disabled
Optimization => Disabled
SHM Cache => Enabled
File Cache => Disabled
Startup Failed => Opcode Caching is disabled for CLI
Directive => Local Value => Master Value
opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => Off => Off
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.file_cache => no value => no value
opcache.file_cache_consistency_checks => 1 => 1
opcache.file_cache_only => 0 => 0
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.huge_code_pages => Off => Off
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 8 => 8
opcache.lockfile_path => /tmp => /tmp
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 10000 => 10000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 128 => 128
opcache.opt_debug_level => 0 => 0
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 2 => 2
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_permission => Off => Off
opcache.validate_root => Off => Off
opcache.validate_timestamps => On => On
Xdebug log related to this part (you can see that $localBar doesn't appear):
<- context_get -i 46 -d 0 -c 0
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="46" context="0"><property name="$newFoo" fullname="$newFoo" type="uninitialized"></property><property name="$this" fullname="$this" type="object" classname="Bar" children="1" numchildren="2" page="0" pagesize="100"><property name="firstMember" fullname="$this->firstMember" facet="public" type="string" size="3" encoding="base64"><![CDATA[Zm9v]]></property><property name="secondMember" fullname="$this->secondMember" facet="public" type="string" size="3" encoding="base64"><![CDATA[YmFy]]></property></property></response>
Any help is welcome, thanks :)
I answer myself, in case it serves to someone.
This is a feature of OPCache. It optimizes PHP code by sometimes removing variables if they are not needed.
Solution: disable OPCache when debugging.
sudo phpdismod opcache
And restart phpfpm or apache according to your environment
sudo service php7.2-fpm restart
or
sudo service apache2 restart
More info here.
It's a late answer, but the accepted one is not entirely correct. The problem is not that you cannot use OPCache with xdebug. You can, but you have to load the OPCache extension BEFORE xdebug. To quote the documentation:
If you want to use Xdebug and OPCache together, you must have the
zend_extension line for Xdebug below the line for OPCache, or in a
file starting with a higher number (ie. 99-xdebug.ini vs
20-opcache.ini), otherwise they won't work properly together.

MongoDate toDateTime() function is not defined?

This is stumping me... I'm using the exact example from:
http://php.net/manual/en/mongodate.todatetime.php
but I'm getting:
PHP Fatal error: Call to undefined method MongoDate::toDateTime()
<?php
$d = new MongoDate(strtotime("2014-11-18 11:01:25"));
var_dump($d);
var_dump( $d->toDateTime() );
?>
The exact output I get is:
object(MongoDate)#1 (2) {
["sec"]=>
int(1416330085)
["usec"]=>
int(0)
}
PHP Fatal error: Call to undefined method MongoDate::toDateTime() in /xxx/testmongodate.php on line 5
PHP version:
$ php -v
PHP 5.5.9-1ubuntu4.9 (cli) (built: Apr 17 2015 11:44:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
PHP config:
$ php -i | grep mongo
/etc/php5/cli/conf.d/20-mongo.ini,
mongo
mongo.allow_empty_keys => 0 => 0
mongo.chunk_size => 262144 => 262144
mongo.cmd => $ => $
mongo.default_host => localhost => localhost
mongo.default_port => 27017 => 27017
mongo.is_master_interval => 15 => 15
mongo.long_as_object => 0 => 0
mongo.native_long => 0 => 0
mongo.ping_interval => 5 => 5
I have been successfully using this installation to insert into and read from an actual mongo database, but now I'm trying to work with MongoDate objects as they are read out of mongo, trying to format them for insert into another database... that is why I'm looking to use this method... but it doesn't seem to be found... ??
$ uname -a
Linux server1 3.13.0-52-generic #86-Ubuntu SMP Mon May 4 04:32:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
For anybody coming to this question late (as I did), the likely issue is that the PHP is using a different Mongo driver. There are currently 2 and the below code is for the legacy driver.
The solution with the legacy driver is to get the date from the Mongo Date using the PHP date function:
<?php
$d = new MongoDate(strtotime("2014-11-18 11:01:25"));
$newdate = date('Y-m-d H:m:s',$d->sec);
var_dump( $newdate );
?>

wso2, wsf-php segmentation fault on script shut down

I'm trying to use WSO2 Web Services Framework for PHP 2.1.0 on Kubuntu 11.04 with php 5.3.5-1ubuntu7.7
I have minimal php installation, xml, xslt, lib-ssl, libaxis2c libraries:
apt-get install php5 php5-dev php5-xsl libxml2-dev libssl-dev libaxis2c
Everything went fine -- compiled, and installed, added to include path.
I see the library in php -i output:
wsf
wsf support => enabled
wsf version => 2.1.0
Directive => Local Value => Master Value
wsf.attachment_cache_dir => /tmp => /tmp
wsf.enable_attachment_caching => 0 => 0
wsf.home => /usr/lib/php5/20090626/wsf_c => /usr/lib/php5/20090626/wsf_c
wsf.log_level => 4 => 4
wsf.log_path => /tmp => /tmp
wsf.rm_db_dir => /tmp => /tmp
So I've tried to access simple web-service:
http://www.w3schools.com/webservices/tempconvert.asmx?wsdl
Like this:
$client = new WSClient(array(
'wsdl'=>'http://www.w3schools.com/webservices/tempconvert.asmx?wsdl'
));
$proxy = $client->getProxy();
$response = $proxy->CelsiusToFahrenheit(array('Celsius'=>11));
Script seems to run fine -- got wsdl, connected, parse response and I can print_r the response data:
Array
(
[CelsiusToFahrenheitResult] => 51.8
)
Then script trying to finish and falls with segmentation fault:
[Fri Apr 6 15:42:35 2012] [info] [rampart] rampart_mod shutdown
[Fri Apr 6 15:42:35 2012] [info] [rahas] Rahas module shutdown
Segmentation fault
If I'll comment the soap call, then segmentations fault will disappear.
Is there a way to eliminate this segfault? Thanks.
Which version of SSL are you using?
I've been trying to figure this out for myself as well and come across this
https://wso2.org/jira/browse/WSFPHP-467

Categories