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.
Related
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)
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.
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.
I installed NextCloud and in the summary window it keeps telling me that my OPCache is not enabled. I have enabled it and I am seeing conflicting information about if it really is enabled or not.
Ubuntu 18.04.1 | PHP 7.2.11-2
$ sudo cat /etc/php/7.2/apache2/php.ini | grep opcache
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
;opcache.max_wasted_percentage=5
;opcache.use_cwd=1
;opcache.validate_timestamps=1
opcache.revalidate_freq=1
;opcache.revalidate_path=0
opcache.save_comments=1
;opcache.enable_file_override=0
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
;opcache.blacklist_filename=
;opcache.max_file_size=0
;opcache.consistency_checks=0
;opcache.force_restart_timeout=180
;opcache.error_log=
;opcache.log_verbosity_level=1
;opcache.preferred_memory_model=
;opcache.protect_memory=0
;opcache.restrict_api=
;opcache.mmap_base=
;opcache.file_cache=
;opcache.file_cache_only=0
;opcache.file_cache_consistency_checks=1
; Implies opcache.file_cache_only=1 for a certain process that failed to
;opcache.file_cache_fallback=1
;opcache.huge_code_pages=1
;opcache.validate_permission=0
;opcache.validate_root=0
;opcache.opt_debug_level=0
Here is my output of php -i:
$ php -i
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
Then finally, looking at a phpinfo() generated page, I see it loading the php.ini file from the correct one I have edited from the first block. The only additional .ini file it is loading is from the mods-available folder:
$ sudo cat /etc/php/7.2/mods-available/opcache.ini
; configuration for php opcache module
; priority=10
zend_extension=/usr/lib/php/20170718/opcache.so
There isn't any of the settings in that file, so the only file I see those settings in is the php.ini file, which is the same one being loaded from phpinfo(). These settings have been set for a while too, I am just now noticing they weren't taking affect. So the apache server has been rebooted with these settings saved. What am I missing here?
Edit:
Here are some screenshots of the phpinfo() screen for further clarification:
Well after playing around for a few hours, I think I figured it out. In par with what #Sammitch said. When I was doing an apt-get update, it was installing 7.3 php files for some reason. So I purged those and verified my config for php was set to default to 7.2 and then did another update and autoremove. That seemed to clear that confusion up. Not sure how that happened though.
I am using the following code:
$.post( "includes/modules/list.php" );
And I have tried the following:
jQuery("#empty").load("/includes/modules/list.php", {}, function() {
refreshlist();
});
And:
$.post("/includes/modules/list.php",function(data){
alert(data);
});
It was working fine on IIS but after switching to Apache (which I thought would actually work properly) it stopped working.
Now the IIS server was configured by Plesk, so maybe that has something to do with it?
This is my first post here, so please excuse any of my errors.
Edit: I am did this with XAMPP, meaning that PHP was tied up with it. PHP scripts do work, I did test hello world things and they all work, but when I try to call it, it won't work.
I am using Windows. I am seriously debating just rewriting this in ASP.NET and installing back IIS but this is taking so much time already. This is a personal project but I really do want to have this work and be able to use PHP since that is the most mainstream option.
Another Edit: This is my php -i dump as requested (since I have no idea where to look)
SimpleXML
Simplexml support => enabled
Revision => $Id: a915862ec47f9589309acc4996ca8f6179788746 $
Schema support => enabled
soap
Soap Client => enabled
Soap Server => enabled
Directive => Local Value => Master Value
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400
sockets
Sockets Support => enabled
SPL
SPL support => enabled
Interfaces => Countable, OuterIterator, RecursiveIterator, SeekableIterator, Spl
Observer, SplSubject
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException,
BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryItera
tor, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIte
rator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthExcep
tion, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBo
undsException, OutOfRangeException, OverflowException, ParentIterator, RangeExce
ption, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilter
Iterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIterator
Iterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeE
xception, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHea
p, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStac
k, SplTempFileObject, UnderflowException, UnexpectedValueException
sqlite3
SQLite3 support => enabled
SQLite3 module version => 0.7-dev
SQLite Library => 3.8.4.3
Directive => Local Value => Master Value
sqlite3.extension_dir => no value => no value
standard
Dynamic Library Support => enabled
Path to sendmail => C:\xampp\mailtodisk\mailtodisk.exe
Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
default_socket_timeout => 60 => 60
from => no value => no value
url_rewriter.tags => a=href,area=href,frame=src,input=src,form=fakeentry => a=hr
ef,area=href,frame=src,input=src,form=fakeentry
user_agent => no value => no value
tokenizer
Tokenizer Support => enabled
wddx
WDDX Support => enabled
WDDX Session Serializer => enabled
xml
XML Support => active
XML Namespace Support => active
libxml2 Version => 2.9.1
xmlreader
XMLReader => enabled
xmlrpc
core library version => xmlrpc-epi v. 0.51
php extension version => 0.51
author => Dan Libby
homepage => http://xmlrpc-epi.sourceforge.net
open sourced by => Epinions.com
xmlwriter
XMLWriter => enabled
xsl
XSL => enabled
libxslt Version => 1.1.27
libxslt compiled against libxml Version => 2.7.8
EXSLT => enabled
libexslt Version => 0.8.16
zip
Zip => enabled
Extension Version => $Id: a9db166c839b24cbebccad95120bd535e720038f $
Zip version => 1.12.4
Libzip version => 0.11.2
zlib
ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
Compiled Version => 1.2.7.3
Linked Version => 1.2.7.3
Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value
Additional Modules
Module Name
Environment
Variable => Value
ALLUSERSPROFILE => C:\ProgramData
AMDAPPSDKROOT => C:\Program Files (x86)\AMD APP\
APPDATA => C:\Users\Xilence\AppData\Roaming
asl.log => Destination=file
CommonProgramFiles => C:\Program Files (x86)\Common Files
CommonProgramFiles(x86) => C:\Program Files (x86)\Common Files
CommonProgramW6432 => C:\Program Files\Common Files
COMPUTERNAME => AURORA51
ComSpec => C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK => NO
GPU_MAX_ALLOC_PERCENT => 50
HOMEDRIVE => C:
HOMEPATH => \Users\Xilence
HuluDesktopPath => C:\Users\Xilence\AppData\Local\HuluDesktop\instances\0.9.14.1
\HuluDesktop.exe
LOCALAPPDATA => C:\Users\Xilence\AppData\Local
LOGONSERVER => \\AURORA51
MIBDIRS => C:/xampp/php/extras/mibs
MYSQL_HOME => C:\xampp\mysql\bin
NUMBER_OF_PROCESSORS => 4
OPENSSL_CONF => C:/xampp/apache/bin/openssl.cnf
OS => Windows_NT
Path => ;C:\xampp\;C:\xampp\php;C:\xampp\perl\site\bin;C:\xampp\perl\bin;C:\xamp
p\apache\bin;C:\xampp\mysql\bin;C:\xampp\FileZillaFTP;C:\xampp\MercuryMail;C:\xa
mpp\sendmail;C:\xampp\webalizer;C:\xampp\tomcat\bin;C:\Program Files (x86)\iis e
xpress\PHP\v5.6;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\AMD A
PP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\zpanel\bin\apache\bin;C:
\zpanel\bin\mysql\bin;C:\zpanel\bin\php;C:\zpanel\bin\wget;C:\zpanel\bin\bind\bi
n;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (
x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Co
rporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C
:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologi
es\ATI.ACE\Core-Static;C:\Program Files\Perforce;C:\Program Files (x86)\Windows
Live\Shared;C:\Program Files\Perforce\Server;C:\Program Files\Microsoft\Web Plat
form Installer\;;C:\Program Files\Perforce\Server
PATHEXT => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PHPRC => C:\xampp\php
PHP_PEAR_BIN_DIR => C:\xampp\php
PHP_PEAR_CFG_DIR => C:\xampp\php\cfg
PHP_PEAR_DATA_DIR => C:\xampp\php\data
PHP_PEAR_DOC_DIR => C:\xampp\php\docs
PHP_PEAR_INSTALL_DIR => C:\xampp\php\pear
PHP_PEAR_PHP_BIN => C:\xampp\php\php.exe
PHP_PEAR_SYSCONF_DIR => C:\xampp\php
PHP_PEAR_TEST_DIR => C:\xampp\php\tests
PHP_PEAR_WWW_DIR => C:\xampp\php\www
PROCESSOR_ARCHITECTURE => x86
PROCESSOR_ARCHITEW6432 => AMD64
PROCESSOR_IDENTIFIER => AMD64 Family 16 Model 4 Stepping 3, AuthenticAMD
PROCESSOR_LEVEL => 16
PROCESSOR_REVISION => 0403
ProgramData => C:\ProgramData
ProgramFiles => C:\Program Files (x86)
ProgramFiles(x86) => C:\Program Files (x86)
ProgramW6432 => C:\Program Files
PROMPT => Xilence#AURORA51$S$P$_#$S
PSModulePath => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC => C:\Users\Public
SESSIONNAME => Console
SystemDrive => C:
SystemRoot => C:\Windows
TEMP => C:\Users\Xilence\AppData\Local\Temp
TMP => C:\xampp\tmp
USERDOMAIN => Aurora51
USERNAME => Xilence
USERPROFILE => C:\Users\Xilence
windir => C:\Windows
PHP Variables
Variable => Value
_SERVER["ALLUSERSPROFILE"] => C:\ProgramData
_SERVER["AMDAPPSDKROOT"] => C:\Program Files (x86)\AMD APP\
_SERVER["APPDATA"] => C:\Users\Xilence\AppData\Roaming
_SERVER["asl_log"] => Destination=file
_SERVER["CommonProgramFiles"] => C:\Program Files (x86)\Common Files
_SERVER["CommonProgramFiles(x86)"] => C:\Program Files (x86)\Common Files
_SERVER["CommonProgramW6432"] => C:\Program Files\Common Files
_SERVER["COMPUTERNAME"] => AURORA51
_SERVER["ComSpec"] => C:\Windows\system32\cmd.exe
_SERVER["FP_NO_HOST_CHECK"] => NO
_SERVER["GPU_MAX_ALLOC_PERCENT"] => 50
_SERVER["HOMEDRIVE"] => C:
_SERVER["HOMEPATH"] => \Users\Xilence
_SERVER["HuluDesktopPath"] => C:\Users\Xilence\AppData\Local\HuluDesktop\instanc
es\0.9.14.1\HuluDesktop.exe
_SERVER["LOCALAPPDATA"] => C:\Users\Xilence\AppData\Local
_SERVER["LOGONSERVER"] => \\AURORA51
_SERVER["MIBDIRS"] => C:/xampp/php/extras/mibs
_SERVER["MYSQL_HOME"] => C:\xampp\mysql\bin
_SERVER["NUMBER_OF_PROCESSORS"] => 4
_SERVER["OPENSSL_CONF"] => C:/xampp/apache/bin/openssl.cnf
_SERVER["OS"] => Windows_NT
_SERVER["Path"] => ;C:\xampp\;C:\xampp\php;C:\xampp\perl\site\bin;C:\xampp\perl\
bin;C:\xampp\apache\bin;C:\xampp\mysql\bin;C:\xampp\FileZillaFTP;C:\xampp\Mercur
yMail;C:\xampp\sendmail;C:\xampp\webalizer;C:\xampp\tomcat\bin;C:\Program Files
(x86)\iis express\PHP\v5.6;C:\ProgramData\Oracle\Java\javapath;C:\Program Files
(x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\zpanel\bin\ap
ache\bin;C:\zpanel\bin\mysql\bin;C:\zpanel\bin\php;C:\zpanel\bin\wget;C:\zpanel\
bin\bind\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Prog
ram Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86
)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\Syst
em32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI
Technologies\ATI.ACE\Core-Static;C:\Program Files\Perforce;C:\Program Files (x8
6)\Windows Live\Shared;C:\Program Files\Perforce\Server;C:\Program Files\Microso
ft\Web Platform Installer\;;C:\Program Files\Perforce\Server
_SERVER["PATHEXT"] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
_SERVER["PHPRC"] => C:\xampp\php
_SERVER["PHP_PEAR_BIN_DIR"] => C:\xampp\php
_SERVER["PHP_PEAR_CFG_DIR"] => C:\xampp\php\cfg
_SERVER["PHP_PEAR_DATA_DIR"] => C:\xampp\php\data
_SERVER["PHP_PEAR_DOC_DIR"] => C:\xampp\php\docs
_SERVER["PHP_PEAR_INSTALL_DIR"] => C:\xampp\php\pear
_SERVER["PHP_PEAR_PHP_BIN"] => C:\xampp\php\php.exe
_SERVER["PHP_PEAR_SYSCONF_DIR"] => C:\xampp\php
_SERVER["PHP_PEAR_TEST_DIR"] => C:\xampp\php\tests
_SERVER["PHP_PEAR_WWW_DIR"] => C:\xampp\php\www
_SERVER["PROCESSOR_ARCHITECTURE"] => x86
_SERVER["PROCESSOR_ARCHITEW6432"] => AMD64
_SERVER["PROCESSOR_IDENTIFIER"] => AMD64 Family 16 Model 4 Stepping 3, Authentic
AMD
_SERVER["PROCESSOR_LEVEL"] => 16
_SERVER["PROCESSOR_REVISION"] => 0403
_SERVER["ProgramData"] => C:\ProgramData
_SERVER["ProgramFiles"] => C:\Program Files (x86)
_SERVER["ProgramFiles(x86)"] => C:\Program Files (x86)
_SERVER["ProgramW6432"] => C:\Program Files
_SERVER["PROMPT"] => Xilence#AURORA51$S$P$_#$S
_SERVER["PSModulePath"] => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
_SERVER["PUBLIC"] => C:\Users\Public
_SERVER["SESSIONNAME"] => Console
_SERVER["SystemDrive"] => C:
_SERVER["SystemRoot"] => C:\Windows
_SERVER["TEMP"] => C:\Users\Xilence\AppData\Local\Temp
_SERVER["TMP"] => C:\xampp\tmp
_SERVER["USERDOMAIN"] => Aurora51
_SERVER["USERNAME"] => Xilence
_SERVER["USERPROFILE"] => C:\Users\Xilence
_SERVER["windir"] => C:\Windows
_SERVER["PHP_SELF"] =>
_SERVER["SCRIPT_NAME"] =>
_SERVER["SCRIPT_FILENAME"] =>
_SERVER["PATH_TRANSLATED"] =>
_SERVER["DOCUMENT_ROOT"] =>
_SERVER["REQUEST_TIME_FLOAT"] => 1420338712.5439
_SERVER["REQUEST_TIME"] => 1420338712
_SERVER["argv"] => Array
(
)
_SERVER["argc"] => 0
PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file: LICENSE
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license#php.net.
Xilence#AURORA51 c:\xampp
#
I'm a little confused by your question but what I think you are asking is that when your php page is called it returns the php script rather than executing it (I do not see why Ajax is important here - I assume the same happens if you browse directly to the php page in your browser?)
My first question would be whether you have installed php on the server as this is the usual problem in this situation? If not, assuming it it's Linux then run either apt-get install php5 (if it is ubuntu, Debian or similar like Mint) or yum install php5 (if it is Redhat Fedora or Centos)
If php is installed, check your httpd.conf (usually in /etc/httpd/conf) and check that the php module is being loaded - I won't go into loads of detail about this as Google is full of good info on Apache configs.
Also check your php page is executable as it is a script (ls -l yourphppagename.php and look for the x characters on the left)
Okay I fixed it. It was really dumb of me but somewhere in my editing I removed the <?php part at the beginning of the document and only had <? so that had caused it not to be parsed by the server, anyway... thank you so much for your help everyone! Should have just put code here in the first place. I will next time. Again, thank you!