Related
I have been meaning to install ffmpeg as an extension to my PHP setup. So before I can install it, I need to phpize it. I installed php5-dev by sudo apt-get install php5-dev. But now when I run phpize I get the following error :
phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module
The location of my php.ini is /usr/local/zend/etc/php.ini
From another online resource I tried this
sudo apt-get install autoconf automake libtool m4
But all of them are already installed.
Locate config.m4 didn't return anything.
Any pointers here how I can get phpize and thus, ffmpeg up and running?
For recent versions of Debian/Ubuntu (Debian 9+ or Ubuntu 16.04+) install the php-dev dependency package, which will automatically install the correct version of php{x}-dev for your distribution:
sudo apt install php-dev
Older versions of Debian/Ubuntu:
For PHP 5, it's in the php5-dev package.
sudo apt-get install php5-dev
For PHP 7.x (from rahilwazir comment):
sudo apt-get install php7.x-dev
RHEL/CentOS/yum
yum install php-devel # see comments
For PHP7 Users
7.1
sudo apt install php7.1-dev
7.2
sudo apt install php7.2-dev
7.3
sudo apt install php7.3-dev
7.4
sudo apt install php7.4-dev
If not sure about your PHP version, simply run command php -v
Ohk.. I got it running by typing /usr/bin/phpize instead of only phpize.
Under Redhat Enterprise / CentOS, use yum to install the php-devel module:
yum install php-devel
For PHP 7, you need:
yum install php70-php-devel
Step - 1: If you are unsure about the php version installed,
then first run the following command in terminal
php -v
Output: the above command will output the php version installed on your machine, mine is 7.2
PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.3-1ubuntu1, Copyright (c) 1999-2018, by Zend Technologies
Step 2: Then to install phpize run the following command, Since my php version is 7.2.3. i will replace it with 7.2, so the command will be,
sudo apt-get install php7.2-dev
Step 3: Done!
Alternate method(Optional):
To automatically install the phpize version based on the php version installed on your machine run the following command.
sudo apt-get install php-dev
This command will automatically detect the appropriate version of php installed and will install the matching phpize for the same.
Hmm... actually i dont know how this solved it? But the following steps solved it for me:
find / -name 'config.m4'
Now look if the config.m4 is anywhere in a folder of that stuff you want to phpize. Go to that folder and run phpize directly in there.
For ubuntu 14.04LTS with php 7, issue:
sudo apt-get install php-dev
Then install:
pecl install memcache
In Ubuntu 16.04, you can install phpize with the command
aptitude install php7.1-dev // for php 7.1
which is equivalent to
apt-get install php7.1-dev // for php 7.1
If you're having problems with phpize not found on CentOS7.x after you have installed the relevant devel tools for your version/s of PHP, this path finally worked for me:
For PHP 7.2.x
/opt/cpanel/ea-php72/root/usr/bin/phpize
For PHP 7.3.x
/opt/cpanel/ea-php73/root/usr/bin/phpize
For PHP 7.4.x
/opt/cpanel/ea-php74/root/usr/bin/phpize
Run this in your folder containing the downloaded PHP extension, for example in line 3 below:
Example based on installing the PHP v7.3.x Brotli Extension from https://github.com/kjdev/php-ext-brotli
git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git
cd /php-ext-brotli
/opt/cpanel/ea-php73/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
make
make test
Install from linux terminal
sudo apt-get install <php_version>-dev
Example :
sudo apt-get install php5-dev #For `php` version 5
sudo apt-get install php7.0-dev #For `php` version 7.0
Of course in PHP7.2
sudo apt-get install php7.2-dev
This might help someone on ubuntu. No promises.
sudo apt-get install libcurl3 php5-dev libcurl4-gnutls-dev libmagic-dev
sudo apt-get install php-http make
sudo pecl install pecl_http
And adding "extension=http.so" to php.ini (Normally located at /etc/php5/apache2/php.ini)
Then restart Apache (sudo service apache2 restart).
If in doubt, check your apache logs:
sudo su --
cd /var/log/apache2
tail -25 error.log
Is http.so starting or failing?
For instance, if you wanted to use the "phpize" command for PHP 5.6, you would use the full path:
Code:
/opt/cpanel/ea-php56/root/usr/bin/phpize
For ubuntu with Plesk installed run apt-get install plesk-php56-dev, for other versions just change XX in phpXX (without the dot)
Go to the downloaded folder and there you find config.m4. Open the terminal and run phpsize.
I had this exact problem on macOS in 2018.
For me, first running brew install php before sudo pecl install mongodb did the trick.
You didn't specify what operating system you're using, and 90% of the answers assume Ubuntu/Debian Linux because of the apt-get install autoconf automake libtool m4 command that you posted (and over half expect you to be running CPanel), so I'm giving you a slightly more generic solution which ought to work on any Un*x clone (including Microsoft's WSL!).
You will need at least a few prerequisites:
A working C/C++ compiler — GCC or clang being the most popular options these days.
A 'developer edition' of PHP, which some package managers call 'development headers'. In the case of aptitude, as shown on the other answers, you ought to be fine with just sudo apt install php-dev. Beware of the mentioned caveats: you might end up with a slightly more unstable version of PHP which might not be updated correctly with future versions.
These days (that's late 2021 for me!), for those running Ubuntu, and wishing to seriously tinker with PHP, the recommendation is to use Ondřej Surý's personal package archive for PHP. Ondřej keeps his PPA always up to date, sometimes within a few hours after release; he keeps up with the latest four Ubuntu distributions and all the currently supported PHP versions that haven't reached end-of-life status yet (sorry, PHP5 is considered completely obsolete and plagued with unpatched bugs and security issues, so it's not supported — for very good reasons!); and he provides a lot of PHP extensions, too. Sadly, ffmpeg-php is not one of them...
There is a good reason for the overall lack of support of ffmpeg-php. Allegedly, the original repository for that was hosted at Sourceforge but has been abandoned in 2007. The recommended package these days is PHP-FFMpeg which is constantly being updated, and ought to be easily installed using composer — get it before starting your compilation!
Alternatively, instead of relying on an external non-official PHP extension (albeit one that is both popular and updated regularly!), you ought to launch the ffmpeg binary using shell_exec(). This is the officially recommended approach, mostly because converting videos always takes a long time, and the authors of that recommendation suggest a simple architecture where the PHP script basically launches ffmpeg in the background, accepting batches of videos for processing. The page is a bit old, but the technique shown is sound.
I am using XAMPP on Linux mint and it is by default installed if your don't have
sudo apt-get install php7.0-dev
// or
sudo apt-get install php-dev
know more
I have been trying to install laravel for 3 days on ubuntu 16.04. I am following the top search links of laravel installation process. But I failed to execute each and every process I had tried. Now I am facing a different issue on installing PHP on my ubuntu. I had installed maria db once, but did not succeed.
But it might have broken something that resulted in me not being able to install PHP. The issue I am facing:
Reading package lists... Done
Building dependency tree
Reading state information... Done
php is already the newest version (1:7.2+62+ubuntu16.04.1+deb.sury.org+3).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
When I try php -v it gives me this error
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/mcrypt.so' (tried: /usr/lib/php/20170718/mcrypt.so (/usr/lib/php/20170718/mcrypt.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718//usr/lib/php/20170718/mcrypt.so.so (/usr/lib/php/20170718//usr/lib/php/20170718/mcrypt.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.9-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
I am totally new on ubuntu and laravel. And if anyone guide me how to install laravel on ubuntu 16.04 I will be very grateful.
Thank You.
Install git apt-get install git-core
git clone https://github.com/thamaraiselvam/LEMP-Stack-Installer.git
cd quick-lemp-install or cd LEMP-Stack-Installer
chmod +x lemp.sh this command makes bash script executable
./lemp.sh
That's it :)
PHP version - v7.0
Mysql version - Latest Stable
Note: Default mysql password is root. you can change it before running
in the following lines before running the script
sudo debconf-set-selections <<< 'mysql-server
mysql-server/root_password password YOUR_PASSWORD'
sudo debconf-set-selections <<< 'mysql-server
mysql-server/root_password_again password YOUR_PASSWORD'
Now Install Laravel
Go to cd /var/www/html/
sudo apt-get install php-common php-mbstring php-xml php-zip
composer create-project --prefer-dist laravel/laravel blog "5.5.*"
Try to execute the following commands to solve your problem:
Get the list of MySQL packages installed on the system by executing
the command sudo dpkg -l | grep mysql
Remove the the packages shown above by executing the command sudo apt-get --purge autoremove <packages from the step 1>
Delete /var/lib/mysql
Try to install mysql again. It should solve your problem
I just recently launched LAMP version 7.0 using bitnami on google app engine.
I couldn't find the older version of 5.6.
Any idea how i can downgrade the default PHP 7 to PHP 5.6 on my server
upon running this commandphp --version
i get this output
PHP 7.0.22 (cli) (built: Sep 6 2017 14:14:52) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.22, Copyright (c) 1999-2017, by Zend Technologies
kindly note that i have also installed PHP 5 using sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
but the dafault PHP version remains PHP 7.0.22
It is possible just to install the version of php you need. and change the set-up.
ssh into your VM from your console or
gcloud compute ssh [INSTANCE NAME] --ZONE [INSTANCE ZONE]
Inside your VM do:
If add-apt-repository is not installed
sudo apt-get install software-properties-common python-software-properties
then:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
Apache:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.6
Bitnami Stacks are self-contained. That means that they include every component they need (e.g. Apache, PHP, PHP-FPM, MySQL, etc.).
Those components are not installed using the System Package Manager of the Distro (e.g. yum on Centos or apt on Debian). Therefore, if you install a different version of PHP on your Image, you'll have two different PHPs installed. The one in the system and the one in the Stack. However, every component included in the Stack will use the PHP included in the Stack (no matter what version you installed in the system).
You can find the PHP in the LAMP Stack at /opt/bitnami/php. If you want to use PHP 5.X you have several options:
A. Download and install the LAMP Stack with PHP 5.6.x from https://bitnami.com/stack/lamp/installer on your server. After that, remove the previous LAMP Stack with PHP 7.
B. Install PHP using the System Package Manager. Then, modify the environment to remove /opt/bitnami/php from the PATH and also edit the file /opt/bitnami/scristps/setenv.sh to avoid including /opt/bitnami/php again in the PATH.
I'm trying to install php 5.6 on Amazon linux using the following command:
$ yum install php56
No package php56 available.
Error: Nothing to do
Is there a repository I need to add in order to do this? I've searched for this but couldn't find any source. I'd also like to know which Apache versions work with this version of php?
Below are the steps I have used to update PHP version from 5.3 to 5.6 in Amazon Linux
Steps (Use sudo only if required)
1) Remove OLD Apache
sudo service httpd stop
sudo yum erase httpd httpd-tools apr apr-util
2) Remove OLD PHP
sudo yum remove php-*
3) Install PHP 5.6 (Apache 2.4 will be automatically installed with this)
sudo yum install php56
4) Make sure all the required PHP extensions are installed
yum list installed | grep php
5) If not then install them using
sudo yum install php56-xml php56-xmlrpc php56-soap php56-gd
6) To list the other available php extensions
yum search php56
7) PHP 5.6 MySQL extension (Assume you have already installed MySQL)
sudo yum install php56-mysqlnd
(NOTE: it is not php56-mysql)
8) Start / Restart Apache
sudo service httpd start
sudo service httpd restart
9) Check the version
php -v
httpd -v
AWS has not yet packaged php 5.6. You need to install php 5.5 from the ALAMI repositories, or build 5.6 from source.
To list the available 5.5 packages use yum search php55
The php55 is the base package, but you may need others listed as well.
When 5.6 is ready, you'll be able to find it with
yum search php56
You can find information on building the source at php.net, specifically Installation on Unix Systems / Apache 2.x on Unix Systems
Just to mantain update the answers,
I tryed the proposed solution and didn't work.
Quite hard to install 5.6
I found the right command nowaday to install 7.2 is
amazon-linux-extras install php7.2
it install and upgrade everything without complications.
Try this:
sudo yum -y update
sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo wget https://centos7.iuscommunity.org/ius-release.rpm
sudo rpm -Uvh ius-release*.rpm
sudo yum -y update
When you install the package you'll need to add a u to the end of php56. Here is an example of some packages you could install.
sudo yum -y install php56u php56u-opcache php56u-xml \
php56u-mcrypt php56u-gd php56u-devel php56u-mysql \
php56u-intl php56u-mbstring php56u-bcmath php56u-soap
Successfully installed php56 and required php-module on amazonlinux2 with the repo epo.ius.io.
sudo yum -y update
sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://repo.ius.io/ius-release-el7.rpm
sudo rpm -Uvh ius-release*.rpm
sudo yum -y update
sudo yum install --enablerepo=ius-archive php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath php56u-soap
Check PHP version with below command
[root#ip-10-10-1-47 ~]# php -v
PHP 5.6.40 (cli) (built: Jan 11 2019 10:27:04)
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
To install php module
yum install --enablerepo=ius-archive php56u-{Module Name}
Validate the module name
php -m
php -m | grep {Module Name}
example to check php yaml module
php -m | grep yaml
Reference URL : https://forums.aws.amazon.com/thread.jspa?threadID=284157
Additional part from #Daniele post for resloving this problem.
This is more help than question, but to help other with problem which I had in my case. I need to install Wordpress site on EC2, but when I tried to run it with public IP address, it was problem. I tried to install php 5.6, but it was not possible.
I find solution to install php 7.2, using command:
**amazon-linux-extras install php7.2**
TO check that is really version php 7.2, use:
php -version or php -v
After this, you need to stop apache service, command for stop is:
service httpd stop
Start again apache service:
service httpd start
In your AWS console, go to Instance, find public IP address, copy and open in browser. You should see the WordPress page. You can install WordPress in Advanced part (bootstraping), when you create EC2 instance.
How do I install the bcmath module on a server? I tried
yum update php-bcmath
but it said it found nothing.
Try yum install php-bcmath.
If you still can't find anything, try yum search bcmath to find the package name
ubuntu and php7.1
sudo apt install php7.1-bcmath
ubuntu and php without version specification
sudo apt install php-bcmath
yum install php72-php-bcmath.x86_64
cp /etc/opt/remi/php72/php.d/20-bcmath.ini /etc/php.d/
cp /opt/remi/php72/root/usr/lib64/php/modules/bcmath.so /usr/lib64/php/modules/
systemctl restart httpd
Not sure why I had to go so deep considering the yum install gave me bcmath in phpinfo()
Worked great on CentOS 6.5
yum install bcmath
All my calls to bcmath functions started working right after an apache restart
service httpd restart
Sweet!
When using the official PHP images of Docker, use docker-php-ext-install bcmath.
Source: https://hub.docker.com/_/php?tab=description#php-core-extensions
Was getting call to undefined function bcmod()
yum install php-bcmath
systemctl restart httpd.service
you should then see something similar to /etc/php.d/bcmath.ini listed under phpinfo.
Centos 7
Plesk 12
PHP 5.4.16
If you have installed php 7.1
then this line work on your system.
sudo apt install php7.1-bcmath
check your php version in your system on ubuntu 16.04
php -v
and then result show there..
PHP 7.1.x+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018
07:16:12) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine
v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
The following worked for me on Centos 7.4 with PHP 7.1 using remi repository.
First find out which PHP version I have:
[kiat#reporting ~]$ php --version
PHP 7.1.33 (cli) (built: Oct 23 2019 07:28:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies
Then search for bcmath extension in remi-php71 repository:
[kiat#reporting ~]$ yum search php71 | grep bcmath
php71-php-bcmath.x86_64 : A module for PHP applications for using the bcmath
php71u-bcmath.x86_64 : A module for PHP applications for using the bcmath
Now install the first matching extension:
[kiat#reporting ~]$ sudo yum --enablerepo=remi-php71 install php-bcmath
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
.
.
.
Finally, restart php and nginx:
[kiat#reporting ~]$ sudo systemctl restart php-fpm nginx
I found that the repo that had the package was not enabled. On OEL7,
$ vi /etc/yum.repos.d/ULN-Base.repo
Set enabled to 1 for ol7_optional_latest
$ yum install php-bcmath
and that worked...
I used the following command to find where the package was
$ yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo C5.\*,c5-media,\*debug\*,\*-source list \*bcmath
If you want to enable any extension then you have to install an extension first, extension maybe enabled but not installed, so taking the example of bcmath
yum search php-bcmath
Then ensure the php version in which u want to install this extension
You will get output like after yum search command>>
yum search php-bcmath**
Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
EA4: 66.71.244.18
cpanel-addons-production-feed: 66.71.244.18
base: mirror.nodesdirect.com
epel: mirror.coastal.edu
extras: www.gtlib.gatech.edu
nux-dextop: mirror.li.nux.ro
updates: mirror.jaleco.com
**============================================================== N/S matched: php-bcmath ===============================================================
ea-php54-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php55-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php56-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php70-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php71-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
ea-php72-php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
If I wanna install for php71 then the command will be like yum install ea-php71-php-bcmath.x86_64 or yum install php71-bcmath.
You can install any extension from the above steps.
In Ubuntu PHP 7.3
sudo apt install php7.3-bcmath
To enable bcmath in Arch Linux or Manjaro
Edit php.ini
nano /etc/php/php.ini
Uncomment bcmath (remove semicolon)
extension=bcmath
If you are using Apache server reload the server by
sudo systemctl reload apache.server
Or
sudo systemctl realod httpd
If you don't use Apache
sudo systemctl reload php-fpm.service
To see the activated modules
php -m
To make sure the bcmath is installed and activated, search for it
php -m | grep bcmath
This worked for me install php72-php-bcmath.x86_64
Then,
systemctl restart php72-php-fpm.service
For PHP 7+ version you can use only:
sudo apt install php-bcmath
I just tried below package for php v5.6 and it worked for me.
yum install php56w-bcmath
apt repo have this extension, just run the below command from your terminal ::
sudo apt-get install php7.2-bcmath*
If still anyone is not getting how to install bcmath as it has lots of other dependant modules to install like php7.2-common, etc.
Try using synaptic application, to install the same. fire command.\
sudo apt-get install synaptic
Open the synaptic application and then click on search tab.
search for bcmath
search results will show all the packages depends on php.
Install as per your convenience.
and install with all auto populated dependancies it required to install.
That's it.
For Centos 7 with php7.0
Install CentOS SCLo RH repository: yum install centos-release-scl-rh
Install rh-php71-php-bcmath rpm package: yum install rh-php71-php-bcmath
systemctl restart httpd.service
If you want to install PHP extensions in ubuntu.
first know which PHP version is active.
php -v
After that install needed plugin using this command.
sudo apt install php7.0-bcmath
you can replace php7.0-bcmath to php-PHPVersion-extensionName