XCache module installation error - php

In my PHP 5.4 and Centos 6.3 machine I'm trying to install XCache. From this manual I made every step: http://cgibin.info/php/install-xcache-centos/
Inside /etc/php.ini file I added this, and checked that xcache.so file exists in directory
extension = /usr/lib64/php/modules/xcache.so
then I wrote php -v I get this:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/20090626/apc.so' - /usr/lib64/20090626/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.4.18 (cli) (built: Aug 19 2013 14:10:14)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with XCache v3.0.3, Copyright (c) 2005-2013, by mOo
with the ionCube PHP Loader v4.4.1, Copyright (c) 2002-2013, by ionCube Ltd.
with XCache Cacher v3.0.3, Copyright (c) 2005-2013, by mOo
But when I check admin panel I see this:
I added XCache entries to /etc/php.ini.
I don't change /var/www/vhosts/system/example.com/etc/php.ini because that file is auto generated by Plesk 11.5
Also when I make phpinfo(), I don't see a XCache part.
After that I added ini directives to /var/www/vhosts/system/example.com/etc/php.ini and it worked. But whenever I update my Plesk settings I will lose the entries inside that file. I don't prefer to use Plesk UI for php.ini settings. Is it not possible to use /etc/php.ini settings rather than writing them to /var/www/vhosts/system/example.com/etc/php.ini
How can I solve this ?
Some part of my php.ini file like this:
Server API
CGI/FastCGI
Configuration File (php.ini) Path
/etc
Loaded Configuration File
/var/www/vhosts/system/example.com/etc/php.ini
Scan this dir for additional .ini files
/etc/php.d
Additional .ini files parsed
/etc/php.d/apc.ini, /etc/php.d/curl.ini, /etc/php.d/dom.ini, /etc/php.d/fileinfo.ini, /etc/php.d/gd.ini, /etc/php.d/imap.ini, /etc/php.d/ioncube.ini, /etc/php.d/json.ini, /etc/php.d/mbstring.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/newrelic.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_sqlite.ini, /etc/php.d/phar.ini, /etc/php.d/sqlite3.ini, /etc/php.d/wddx.ini, /etc/php.d/xmlreader.ini, /etc/php.d/xmlwriter.ini, /etc/php.d/xsl.ini, /etc/php.d/zend_extensions_psa.ini, /etc/php.d/zip.ini

Trante,
Me again. Try adding the xcache.ini to the php.d directory. This may not work for you, as I have read that the xcache extension needs to be loaded before other extensions. However, I have not been able to confirm this as of today. (It is on my test agenda for my recently rolled rpm.)
Anthony

Make a phpinfo() page.
Check the 'extension_dir' and make sure the xcache.so is in this folder.
If it is in there and still not coming up in phpinfo(), check apache error logs, this should tell you if it has trouble loading the extension and what error occurred along the way.
IMO Your better off compiling this from source, it'll be easier to do and you can have direct control over everything.

Related

Can't connect PHP to my Visual Studio Code

I got stuck while setting up PHP on my Mac. I downloaded it via brew and I have it on my computer.
PHP 8.0.26 (cli) (built: Nov 23 2022 05:33:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.26, Copyright (c) Zend Technologies
with Zend OPcache v8.0.26, Copyright (c), by Zend Technologies
this is what i get when I type php --ini in Terminal:
Configuration File (php.ini) Path: /opt/homebrew/etc/php/8.0
Loaded Configuration File: /opt/homebrew/etc/php/8.0/php.ini
Scan for additional .ini files in: /opt/homebrew/etc/php/8.0/conf.d
Additional .ini files parsed: /opt/homebrew/etc/php/8.0/conf.d/ext-opcache.ini
I tried to add /opt/homebrew/etc/php/8.0 into my settings.json but it didn't work out.
I appreciate any help!
I tried to change path of PHP to MAMP's PHP, but it did not apply. Also I have phpinfo.php file that is located in:
/Library/WebServer/Documents/phpinfo.php

upgrade server php version in Cpanel

I have to run composer in cpanel terminal to install and host laravel project. But however, it gives this error This package requires php ^7.2.5 but your PHP version (5.6.40) does not satisfy that requirement.
I go Settings >> MultiPHP Manager and select my domain and upgrade PHP version to 7.3
I check my PHP version in ~
[myuser#server ~]$ php -v
PHP 5.6.40 (cli) (built: May 5 2020 19:25:18)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
I go to public_html/www (where my laravel project is placed)
[myuser#server www]$ php -v
PHP 7.3.18 (cli) (built: May 21 2020 03:33:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.18, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.18, Copyright (c) 1999-2018, by Zend Technologies
I go to server_information under General Information and the PHP version is 5.6,
so my question is
How to upgrade server PHP version from 5.6 to 7.3
Please note that I don't have root access, and also ApacheEasy4 is also not accessible by my user in Server.
My MultiPHP Manager Image
if in "phpversion" function you see the version of php is 7.x, but in composer is 5.x: it's because your server manager has set default php path in its envirnoment variables to php5 folder. so you need to use "/php/version/php composer" instead of "php composer"
example:
/usr/bin/local/php/7.3/php composer update
for find the path of php binary file, you can use "php --ini" command to see where is "php.ini" location. when you execute this command it tell you the ini configuration file (php.ini) path. actually in the parent of your ini file location is a direction with bin name that its your php binary file location. for example in my server output "php --ini" is:
Configuration File (php.ini) Path: /usr/local/php72/lib
Loaded Configuration File: /usr/local/php72/lib/php.ini
Scan for additional .ini files in: /usr/local/php72/lib/php.conf.d
Additional .ini files parsed: /usr/local/php72/lib/php.conf.d/10-directadmin.ini,
/usr/local/php72/lib/php.conf.d/50-webapps.ini
so is my configuration file (php.ini) path:
/usr/local/php72/lib
and my php binary file is:
/usr/local/php72/bin
and my needed command is:
/usr/local/php72/bin/php composer update
Note: please pay attention don't use "which php". because its show you the global envirnoment value of php path that in your case it has set on php 5.x so you need to call binary file from php 7.x folder. and for do it, you should follow my guide to find your php 7.x binary file path
This command worked for me in CLOUDLINUX 7.9 and cPanel v94.0.4:
/opt/cpanel/ea-php73/root/usr/bin/php /opt/cpanel/composer/bin/composer update
Click on manage on the right and update the server version.

Xdebug installed according to APT but not in info.php

I am trying to configure Xdebug on a local LAMP server with PHP 5.6 and Ubuntu 16.04 installed and am running into some difficulties. After first following the common installation directions: running "sudo apt install php-xdebug", modifying my php.ini to have the correct config, then restarting my apache server, I was not seeing Xdebug in my info.php (only the xdebug.ini that was being parsed in). When I run "sudo apt install php-xdebug" again however it would say that it was installed / up to date.
After trying a couple different things I was looking and saw that the new version of Xdebug no longer supports version lower than PHP 7, as such I saw what other versions were available by apt and purged the current Xdebug install I had in favor of running "sudo apt install php-xdebug=2.4.0-1" as I saw that version still supported older PHP versions. After this I still had the same issue however so I searched for similar issues.
I tried running "php -m" and "php5.6 -m" and both had different outputs but neither had Xdebug listed under Zend modules. Also ran "php --ini" and the output was
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
"php5.6 --ini" on the other hand outputs:
Failed loading /usr/lib/php/20131226/usr/lib/php/20131226/xdebug.so: /usr/lib/php/20131226/usr/lib/php/20131226/xdebug.so: cannot open shared object file: No such file or directory
Configuration File (php.ini) Path: /etc/php/5.6/cli
Loaded Configuration File: /etc/php/5.6/cli/php.ini
Scan for additional .ini files in: /etc/php/5.6/cli/conf.d
Additional .ini files parsed: /etc/php/5.6/cli/conf.d/10-mysqlnd.ini,
/etc/php/5.6/cli/conf.d/10-opcache.ini....
In case it helps here is the output for "php -v"
PHP 5.4.45 (cli) (built: Nov 15 2017 10:53:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
And "php5.6 -v"
PHP 5.6.34-1+ubuntu16.04.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
Not sure why "php -v" shows a different version of PHP and Zend Engine than "php5.6 -v" but figured it may be relevant to my issue. Anyways, I checked to make sure "xdebug.so" existed in that directory so I ran "locate xdebug.so"
/usr/lib/php/20131226/xdebug.so
/usr/lib/php/20151012/xdebug.so
In the "php5.6 --ini" output it was clear that some path was getting appended to the one I was adding in my /etc/php/5.6/cli/php.ini file, so I commented out
;zend_extension="usr/lib/php/20131226/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.remote_enable = On
xdebug.remote_mode = req
xdebug.remote_connect_back = 1
xdebug.profiler_enable = On
xdebug.profiler_enable_trigger = On
After doing that when I run "php5.6 --ini" I no longer get the failed loading error but still Xdebug is no where to be found / used. I used step 4 in Check if xdebug is working to check if it is installed properly and I always get call to undefined function so it's clear the installation is wrong. My end goal here is to get Xdebug set up so I can link it with Sublime but the first step is obviously just getting Xdebug installed on my server.
My hunch is it's something to do with my differences between php and php5.6? I've usually been able to get to the bottom of issues through hunting online but at this point I feel like I've tried most suggestions and genuinely don't know what I should do; my experience with these sort of issues is limited as well. Also https://xdebug.org/wizard.php doesn't help as it just says under PHP 7 isn't supported. Hopefully I've detailed everything I've tried so far, any help or things I could try would be greatly appreciated, also if I can provide any more details to figure this out just let me know.

MAMP ext mongo.so not loading. How to fix it?

I know there's multiple post about this, but I tried almost everything i found out ..
My problem is that I'm trying to add mongo.so to my MAMP server. It compiles perfectly with the phpize of MAMP and php-config of MAMP. But when I'm trying to put it in the php.ini, it doesn't load it ..
php --version :
PHP 5.5.14 (cli) (built: Jul 25 2014 17:02:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
phpize -v :
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
php --ini :
Configuration File (php.ini) Path: /Applications/MAMP/bin/php/php5.5.14/conf
Loaded Configuration File: /Applications/MAMP/bin/php/php5.5.14/conf/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
I tried changing that php.ini, restart and nothing ..
I tried changing the php.ini in /Applications/MAMP/conf/php5.5.14/, restart and nothing ..
What else is needed to adjust to fix it?
EDIT:
I just found out that the PHP API on my phpinfo() page is set to 20121113. What I don't understand is why that doesn't take the same version on my phpize related to the php server ...
Finally, I fixed it myself. For everybody passing by, please note that this was my PHP sources that was not in the good version. So the extension was not configuring with the right version.

PHP 5.5 OPCache not working on apache

I'm in charge of the opcode cache exchange here in my company, we're moving from eaccelerator to the Zend OPCache shipped with PHP 5.5.
When I access PHP in CLI, it seems like the OPCache is working fine:
PHP 5.5.5 (cli) (built: Oct 15 2013 10:29:13)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
But when I access my website via Apache, the benchmarks show no improvements compared to the same pages using no opcode cache. Also, get_loaded_extensions(true) returns an empty array.
Can anyone answer me why on earth it isn't working?
I'm using windows 7, Apache 2.4.6 from Apache Lounge, PHP 5.5.5 from windows.php.net.
EDIT:
As requested, my OPCache configuration:
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
;opcache.max_wasted_percentage=5
;opcache.use_cwd=1
;opcache.validate_timestamps=1
opcache.revalidate_freq=60
;opcache.revalidate_path=0
;opcache.save_comments=1
;opcache.load_comments=1
opcache.fast_shutdown=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
Found the answer!
zend_extension extensions must set the complete path, not a relative one.
In this case, zend_extension="C:\Apache24\php\ext\php_opcache.dll" solved my problems.
WINDOWS PHP 7 SOLUTION
By default there are opcache settings in php.ini files like opcache.eneable but enabling opcache does not take effect unless you add:
zend_extension=php_opcache.dll
to your config file. Remember it is zend_extension and not regular exstension !
Make sure that you have "opcache" in your phpinfo(); report. By default:
A DLL for this PECL extension is currently unavailable. See also the building on Windows section.
Can you confirm that the extension is loaded?

Categories