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
Related
I am a new Linux Mint user. In my computer I found PHP version 7.1 from phpinfo() like below
I found PHP version 7.4.3 from terminal like below
My /etc/php/ folder is like below
Which PHP version am I using ?
Try in your terminal
which php
your will find your terminal PHP path.
You have multiple versions installed and you're using the version that PHP tells you you are using.
When you use the webserver module version of PHP it is version 7.1.33. When you use the command line version you are using 7.4.3.
You might also have 7.0 and 7.2 installed (or they may be folders for leftover config files in versions that have since been uninstalled).
Disable php 7.1 module on Apache
sudo a2dismod php7.1
and enable php 7.4
sudo a2enmod php7.4
sudo systemctl restart apache2
The php version used by the CLI and the one used by apache CAN be different.
The installed versions are listed in your /etc/php/ folder as you already emntioned.
To switch the used version for apache you can use the following commands:
sudo a2dismod php7.1
sudo a2enmod php7.4
Also you have to restart your apache afterwards.
Reference: https://serverfault.com/questions/149039/how-to-change-what-version-of-php-apache2-uses
I have an Ubuntu 16.04 vagrant box running on php 7.1. When I try to build xdebug by running ./configure in xdebug-2.6.0 I get
Check for supported PHP versions... configure: error: not supported. Need a PHP version >= 7.0.0 and < 7.3.0 (found 5.5.9-1ubuntu4.24)
PHP -v yields
Xdebug requires Zend Engine API version 320170718.
The Zend Engine API version 320160303 which is installed, is outdated.
PHP 7.1.15-1+ubuntu14.04.1+deb.sury.org+2 (cli) (built: Mar 6 2018 11:27:08) ( NTS )
So the system is running 7.1, but for some reason the configure script thinks we're still on 5.5.9
I've hit google pretty hard, but still can't find a way to update the Zend engine either.
Any ideas?
It happens because you're configuring with default settings and that is different from the PHP version you're trying to configure.
Just like you saw the PHP version using the php -v command, check the php-config version using the php-config --version command, it should be the same as php -v, but in your case, it would be different and hence this issue.
Now let's talk about how we can solve it. Since you need a different version of config, you should point that to the configure command.
For example, in your case, you need php-config7.1 (because you're using PHP v7.1, similarly for 7.2 you have php-config7.2 and so on)
To point the configure command to a specific PHP version you need to specify that as a flag called with-php-config and the value should be the location of the php-config file, a sample would be
./configure --with-php-config=/usr/bin/php-config7.1
Hope this solves the problem.
I assume you run phpize before running ./configure. Instead you need to run phpize7.1 and then ./configure
if you don't have phpize7.1 installed you can install it via:
sudo apt install apt install php7.1-dev
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
I have updated PHP 5.5.9 to PHP 5.6.31 using the command lines in Ubuntu.
This is the picture
And then I was trying to install CakePHP, but it is showing that "your PHP version must be equal or higher than 5.6.0 to use CakePHP."
This is the error message of cakePHP
I am doing work in Linux(Ubuntu) Operating system.
What can I do now?
Your PHP CLI version and the version configured with your web server can very well be different. If you check phpinfo(), you can see exactly what paths and what not are in use.
I have found the solution. PHP CLI and PHP Apache are the different module. We have to notice the Apache server PHP version which is showing by-
<?php
phpinfo()
?>
To run the same version, first I disabled the PHP 5.5.9 version-
sudo a2dismod php5
Then I enabled the PHP 5.6 version-
sudo a2enmod php5.6
Restart the server-
sudo service apache2 restart
I am trying to use the normalizer_normalize() function introduced in PHP 5.3 (says the doc), however I can't use it:
$ php -r 'echo normalizer_normalize("tést");'
PHP Fatal error: Call to undefined function normalizer_normalize()
in Command line code on line 1
I've checked my PHP version but it's 5.3:
$ php --version
PHP 5.3.6 (cli) (built: Sep 12 2011 18:02:42)
I don't understand why PHP can't find it?
Normalizer is part of the intl extension. While it's built by default, that does not necessarily mean that the specific version of PHP that you are using has it installed or enabled by default.
If you're getting your PHP version from your operating system, check to see if the package manager has a package named php-intl. If not, check for php-pecl-intl. If you're using RHEL/CentOS/Scientific Linux 5.x, also look for php53-intl.
I wanted to give a modern, up-to-date answer, as things seem to have changed a bit since 2012. Using Ubuntu 20.04 and PHP8.1, I was able to get this to work with just...
sudo apt-get install php8.0-intl
Don't forget to do a full apache restart afterwards (either one of these should do it)...
systemctl restart apache2
/etc/init.d/apache2 restart
In addition, this automatically installed the updated 8.1-version...
root# dpkg --list | grep 'intl'
ii php8.0-intl 1:8.0.21-2+ubuntu20.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php8.1-intl 8.1.8-1+ubuntu20.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP