I have enabled php 7.3 sudo a2enmod php7.3 but PHP_VERSION_ID contains old version 50640(apache restarted). Here is what is the server version
php -v
PHP 7.3.15-3+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 23 2020 07:23:33) ( NTS )
what else need to change?
Can you try to create a file in your web folder and add
<?php
phpinfo()
Make sure your apache has been moved to the new PHP version.
Can you share the DISTRO and what steps you take to enable the PHP 7.3
Thank you
remove /etc/apache2/conf-enabled/php5.6-fpm.conf solved the problem
Related
I use hosting and in my setting php version is 7.4.16. but if i use phpshell and check version with php -v output is:
PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
why?
I can not use phpshell?
Many providers have diffrent versions of php installed, try php72, php73 or ask your provider what the settings are. You may have to provide the full path to the php executable like:
/usr/bin/php-7.4/php -v
I have a very annoying problem. I have 2 versions of PHP on MacOS Catalina, and no matter what I do, I cant seem to get rid of the old (php 7.3.x) version. I can't change anything in /usr/bin/ on my Mac, even though I'm an admin user.
The 2 versions of PHP are:
$ /usr/bin/php -v
PHP 7.3.11 (cli) (built: Apr 17 2020 19:14:14) ( NTS )
$ /usr/local/bin/php -v
PHP 7.4.9 (cli) (built: Aug 7 2020 19:23:06) ( NTS )
Even though which php and php -v use 7.4:
$ which php
/usr/local/bin/php
$ php -v
PHP 7.4.9 (cli) (built: Aug 7 2020 19:23:06) ( NTS )
The problem is that when my cron job runs, it uses /usr/bin/php (version 7.3.x), making my cron job fail (turns out some Laravel package code - specifically Mailcoach - is not compiant with php 7.3.* and NEEDS php v 7.4 or above.
This is what my PATH variable looks like:
$ echo $PATH
/usr/local/bin/php:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:./vendor/bin:/usr/local/sbin:/Users/kunalpunjabi/.composer/vendor/bin:/usr/local/mysql/bin:/usr/local/bin/mysql
If you've encountered this before or know how to fix it, please help!
Did you install them trough homebrew?
If so try linking php7.4
First look at what php is currently running trough
brew services list
Then stop and unlink that version with
brew services stop {PHP}
brew unlink {PHP}
Then link the correct version
brew link --force --overwrite php#7.4
brew services start php#7.4
Could you try this?
If this not works, could you upload a screenshot of your 'brew services list'
I install php via brew. With brew install PHP. My version of php-cli is 7.2
But, if I use phpinfo() on my server, I get php version 7.1.
If I use php -v in my terminal, I get php version 7.2.
Disclaimer: I'm adding this hopefully extensive answer as part of the Revival badge. (Answer more than 30 days after a question was asked as first answer scoring 2 or more)
TL;DR
php -v settings can be different from phpinfo() inside your web-server due to the running service state of fpm and your webserver. Perhaps you need to restart php-fpm and/or your web-server (apache, nginx, ..).
Long version: Command line
Command-line based calls like php -v or php -i or php test.php will read your configuration, options and arguments every time you execute your script within a terminal.
This means if you update php in your operating system then you'll get the most recent version in your terminal session.
Attention: Depending on your PATH variables you still might get an older version.
What does this mean? Even if you update your php version on your operating system you might still have an older terminal session which links to an older php-binary.
Here is an example: I am an OSX user and installed php through brew. Currently php links to php#7.3. Here is my way to validate which versions are running where. For this I'm using which php.
$ which php
/usr/local/opt/php#7.3/bin/php
$ php -v
PHP 7.3.11 (cli) (built: Oct 24 2019 11:29:42) ( NTS )
// or the equivalent "absolute path" example
$ /usr/local/opt/php#7.3/bin/php -v
PHP 7.3.11 (cli) (built: Oct 24 2019 11:29:42) ( NTS )
I have multiple php-versions installed on my local system. I can run them all individually. Here is an example:
$ /usr/local/opt/php#7.2/bin/php -v
PHP 7.2.20 (cli) (built: Jul 5 2019 12:56:54) ( NTS )
Long version: Why is my phpinfo() using the wrong php version?
Since we now have an understanding that we can run multiple and different versions of php on a single operating system, lets dig into our web-server based script which runs phpinfo().
After installing a new php-version you'll have your binaries replaced by new versions. Awesome! but.. how does my running web server get notified about it?
For this I'll refer to the php documentation Apache 2.x on Unix systems Point 7. Also apache allows us to load different modules for PHP.
Edit your httpd.conf to load the PHP module. [...]
For PHP 7:
LoadModule php7_module modules/libphp7.so
For PHP 5:
LoadModule php5_module modules/libphp5.so
Since you are upgrading from PHP 7.1 to PHP 7.2 there is probably no change but your webserver is still running the old linked version of php.
In this case a restart of your apache webserver should help so it can pickup the new binaries correctly.
Please let me know if this will help you to solve your issue. For all the other readers: If you think there is something missing OR there is something wrong in my explanation then please let me know with a comment.
I'm trying to use pthreads but for this i hafe to install the pthread php extention.
My server is already setup with php 7.0 and as I read whats the best way to use it is i found this https://gist.github.com/emiglobetrotting/4663ffc4484e9384a261#file-php7_zts_pthreads-sh-L95
This is a manual how to compile ur own php version with Thread Safety enabled
i did this and now if I run
php -v
it show me the correct php version:
PHP 7.3.0-dev (cli) (built: May 7 2018 09:54:09) ( ZTS DEBUG )
but if i run phpinfo on my Apache I found:
PHP Version 7.0.28-0ubuntu0.16.04.1
So now i look for a way to change this in my apache config but what ever i try it leads me to the same problem:
I need a module that i can enable.
So my question is how could i change my apache to the correct version or how can i create/install a module to use the new php version?
You can do this by following commands.
sudo a2dismod php7.3.0-dev ; // To disable a PHP 7.3.0-dev version
sudo a2enmod php7.0 ; // To enable a PHP 7.0 version
sudo service apache2 restart // then restart apache
I tried to install Phalcon PHP but I got an error
php 5.3 is no longer supported
I check PHP Version
$ php -v
return
PHP 7.0.25-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Oct 27 2017 13:43:45) ( NTS )
but I check in phpinfo();
PHP Version 5.6.32-1+ubuntu16.04.1+deb.sury.org+1
Phpinfo() will always show the version your server is currently running. You will need to change the php version that apache is using. You can do this by disabling PHP 5 module by checking your apcahe files or disabling with 'sudo a2dismod php5'. Then you will need to enable php 7 by allocating in your files or again enabling it with 'sudo a2enmod php7.1'. To see results you will need to restart apache. I hope this helps