Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install and run phpize

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?

like image 310
Hrishikesh Choudhari Avatar asked Jun 24 '10 10:06

Hrishikesh Choudhari


People also ask

Where can I run Phpize?

The phpize command is meant to be run at the top level of an extension source directory. This source directory should contain a file named config.

What is Phpize?

phpize is a shell script to prepare PHP extension for compiling.


14 Answers

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
like image 200
Blackout Avatar answered Sep 29 '22 03:09

Blackout


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

like image 36
M_R_K Avatar answered Sep 29 '22 03:09

M_R_K


Ohk.. I got it running by typing /usr/bin/phpize instead of only phpize.

like image 27
Hrishikesh Choudhari Avatar answered Sep 29 '22 05:09

Hrishikesh Choudhari


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
like image 23
fedorqui 'SO stop harming' Avatar answered Sep 29 '22 05:09

fedorqui 'SO stop harming'


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.

like image 32
Manoj Selvin Avatar answered Sep 29 '22 03:09

Manoj Selvin


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.

like image 28
Bosh Avatar answered Sep 29 '22 04:09

Bosh


For ubuntu 14.04LTS with php 7, issue:

sudo apt-get install php-dev

Then install:

pecl install memcache
like image 43
pingle60 Avatar answered Sep 29 '22 04:09

pingle60


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
like image 42
num3ri Avatar answered Sep 29 '22 05:09

num3ri


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
like image 25
Invisionary Avatar answered Sep 29 '22 05:09

Invisionary


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
like image 35
Sumon Sarker Avatar answered Sep 29 '22 04:09

Sumon Sarker


Of course in PHP7.2

sudo apt-get install php7.2-dev
like image 27
HMagdy Avatar answered Sep 29 '22 05:09

HMagdy


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?

like image 44
ted.strauss Avatar answered Sep 29 '22 05:09

ted.strauss


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
like image 40
Shobhit Verma Avatar answered Sep 29 '22 03:09

Shobhit Verma


For ubuntu with Plesk installed run apt-get install plesk-php56-dev, for other versions just change XX in phpXX (without the dot)

like image 39
Sanel Avatar answered Sep 29 '22 05:09

Sanel