Skip to content

Instantly share code, notes, and snippets.

@nandes2062
Forked from hollodotme/Install-php7.md
Last active June 22, 2017 02:35
Show Gist options
  • Save nandes2062/980dd892e5fbd5c3d3aadfaa80f09863 to your computer and use it in GitHub Desktop.
Save nandes2062/980dd892e5fbd5c3d3aadfaa80f09863 to your computer and use it in GitHub Desktop.
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.1-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.1 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.1-fpm with needed extensions
apt-get install libapache2-mod-php7.1 php7.1-fpm php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-phpdbg php7.1-mbstring php7.1-gd php7.1-imap php7.1-ldap php7.1-pgsql php7.1-pspell php7.1-recode php7.1-snmp php7.1-tidy php7.1-dev php7.1-intl php7.1-gd php7.1-curl php7.1-zip php7.1-xml

UPDATE 2016-03-10

As mentioned by @jackmcpickle php-redis can now be installed with apt-get install php-redis and should be equivalent to the manual installation below. After installation phpinfo() says: Redis-Version 2.2.8-devphp7

Same with xdebug. apt-get install php-xdebug will install the newly released stable version 2.4.0 that has php7 support.

So the manual installations below are not needed any longer.


Build phpredis extension

git clone https://github.com/phpredis/phpredis.git
cd phpredis
git checkout php7
phpize
./configure
make && make install
cd ..
rm -rf phpredis

Activate phpredis extension in fpm and cli

echo "extension=redis.so" > /etc/php/7.1/mods-available/redis.ini

ln -sf /etc/php/7.1/mods-available/redis.ini /etc/php/7.1/fpm/conf.d/20-redis.ini

ln -sf /etc/php/7.1/mods-available/redis.ini /etc/php/7.1/cli/conf.d/20-redis.ini

service php7.1-fpm restart

nginx vhost config

Replace unix:/var/run/php5-fpm.sock with unix:/var/run/php/php7.1-fpm.sock

service nginx restart

Install xdebug extension

# Download stable release of xdebug 2.4.0
wget -c "http://xdebug.org/files/xdebug-2.4.0.tgz"
# Extract archive
tar -xf xdebug-2.4.0.tgz

cd xdebug-2.4.0/

# build extension
phpize
./configure
make && make install

Enable the extension:

echo "zend_extension=xdebug.so" > /etc/php/7.1/mods-available/xdebug.ini

ln -sf /etc/php/7.1/mods-available/xdebug.ini /etc/php/7.1/fpm/conf.d/20-xdebug.ini
ln -sf /etc/php/7.1/mods-available/xdebug.ini /etc/php/7.1/cli/conf.d/20-xdebug.ini

service php7.1-fpm restart

# Check it
php -m | grep -i xdebug

# should print:
xdebug
Xdebug

SI UBIESE ERRORES INSTALAR

sudo apt-get install snmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment