I'm a bit confuse on my PHP versions on my local Mac OS X.
When I ran
⚡️ ~ which php
/usr/local/php5/bin/php
⚡️ ~ php --version
PHP 7.3.8 (cli) (built: Aug 11 2019 20:50:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.8, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
⚡️ ~
so this means my CLI version is 5 or 7.3 ?? 😵 !
When I run
php -r "echo ini_get('memory_limit').PHP_EOL;"
I got
256M
the result of that matched with my Apache PHP
See picture below
phpinfo()
I really need to update the meory_limit.
How do I find php.ini of my Apache use?
Updated
I tried to modify /usr/local/php5/lib/php.ini
and set memory_limit = 40096M ~40GB
I never see that settings take place.
Maybe you should just rename /usr/local/php5 to /usr/local/php and the confusion is gone ;)
On your phpinfo() page is a section called "Loaded Configuration File" and "Additional .ini files parsed". These are the files to edit.
I am not sure if there is an upper limit for memory_limit. Maybe just try to set it to -1 to disable it.
Some php installations use different .ini files for running in a cli and running in a browser, to check what .ini files are used on command line use php --ini.
Related
Trying to install Xdebug so I can debug PHP with VS Code, followed the instructions of the page step by step, reference Xdebug wizard.
Download php_xdebug-3.1.6-8.1-vs16-x86_64.dll
Move the downloaded file to \xampp\php\ext, and rename it to php_xdebug.dll
Update C:\xampp\php\php.ini and add the line:
zend_extension = xdebug
Restart the Apache Webserver
To verify correct installation run cmd and type php -v, output should list Xdebug installed:
PHP 7.4.10 (cli) (built: Aug 18 2020 09:37:14) ( NTS DEBUG )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.10-dev, Copyright (c), by Zend Technologies
with Xdebug v3.0.0-dev, Copyright (c) 2002-2020, by Derick Rethan
Installation is trivial, I don't have cloned .ini files, I'm getting the right dll from the page, I'm restarting Apache, my renameing of the dll is right. I don't know what is going on, my output from cmd is:
C:\Users\User>php -v
PHP 8.1.13 (cli) (built: Nov 22 2022 15:49:14) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
My PHP version is: 8.1.12
Also tried changing the ini file to
;zend_extension="c:\xampp\php\ext\php_xdebug.dll"
which is the actual path where the dll is located. Also my PHP is TS, so is the file it's downloading from the wizard. Any hints?
As #aynber said in a comment, semicolon is used for indicating comments and therefore the line
zend_extension="c:\xampp\php\ext\php_xdebug.dll"
is not processed
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.
I have two versions of PHP in opt/remi folder php56 and php72
but when I php -v on cmd it shows:
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
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
How to set default version to PHP 7.2?
I have two versions of PHP in opt/remi folder php56 and php72
how to set default version to PHP 7.2
SCL are designed for parallel installation so don't alter default version in base system
Once the collection is enabled, the version will be used
$ scl enable php72 bash
$ php -v
PHP 7.2.8 (cli) (built: Jul 17 2018 05:35:43) ( NTS )
If you want 7.2 to be the default version (base system) you should install it, according to Wizard instructions for "Default / single version" (and keep 5.6 as secondary version)
Change php cli version in Centos 7
First, find your php7, run phpinfo() and get path or you can do with other ways. for me, it is:
/usr/local/lsws/lsphp73/
then:
cd ~
. ~/.bash_profile
And:
alias php='/usr/local/lsws/lsphp73/bin/php'
Now:
php -v
PHP 7.3.13 (cli) (built: Dec 20 2019 16:02:35) ( NTS )
Create a file "/etc/profile.d/php.sh". Use pathmunge to add the path to your php bin you want as default on line one and save the file.
Example:
pathmunge /opt/remi/php73/root/bin
Reload your profile afterwards by logging in again.
Now if you do a which php and php -v you should see the following output in my case
[root#host etc]# which php
/opt/remi/php73/root/bin/php
[root#host etc]# php -v
PHP 7.3.4 (cli) (built: Apr 2 2019 13:48:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.4, Copyright (c) 2002-2019, by ionCube Ltd.
This is the preferred way to accomplish this task using tools that are already supplied on a minimal install. This also allows scripts and commands to hit the correct php binaries when accomplishing other tasks. Commands like, pear, pecl, phar, php-config. You want your experience to be global when setting the default, otherwise you might wind up still getting version 5.6's tools when trying to install an extension or complete another task.
module enable php74
for your understanding:
cat /opt/remi/php74/enable
export PATH=/opt/remi/php74/root/usr/bin:/opt/remi/php74/root/usr/sbin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/opt/remi/php74/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export MANPATH=/opt/remi/php74/root/usr/share/man:${MANPATH}
UPDATE 16.03.2017:
I checked the log and found the following error:
Xdebug requires Zend Engine API version 320151012. The Zend Engine API version 320160303 which is installed, is newer. Contact Derick Rethans at xdebug.org/docs/faq#api for a later version of Xdebug
I understand that I need to compile xdebug using another PHP header but how do I compile this with PHP7? Also, I am already using the latest xdebug version, which is 2.5.1
I installed xdebug on ElementaryOS together with XAMPP (PHP7) and PHPStorm.
When I enter "php -v" in the terminal, I get the following output
PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.15-0ubuntu0.16.04.4, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
In addition, "php --ini" writes:
Configuration File (php.ini) Path: /etc/php/7.0/cli
Loaded Configuration File: /etc/php/7.0/cli/php.ini
Scan for additional .ini files in: /etc/php/7.0/cli/conf.d
Additional .ini files parsed: /etc/php/7.0/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.0/cli/conf.d/10-opcache.ini,
But when running "phpinfo()" in the browser (hosted by XAMPP) the output does not contain "xdebug" and the php installation seems to be another:
Configuration File (php.ini) Path /opt/lampp/etc
Loaded Configuration File /opt/lampp/etc/php.ini
In both php.ini files, I added the following but still no luck:
;[XDebug]
zend_extension="/usr/lib/php/20151012/xdebug.so"
xdebug.remote_enable=On
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
I checked that xdebug.so exists at this path. It has the following authorizations:
-rw-r--r-- 1 root root 1225696 Mär 14 2016 /usr/lib/php/20151012/xdebug.so
I have no clue what to try next - maybe someone could give me a hint!
Cheers!
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?