简体   繁体   中英

how to install phalcon php on amazon linux

I followed the phalcon documentation and added the repo to my system.

> curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.rpm.sh | sudo bash
...
The repository is setup! You can now install packages.

But then when I continue to follow documentation:

> yum install php70u-phalcon
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
No package php70u-phalcon available.

And searching for phalcon does not return anything:

> yum search phalcon
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Warning: No matches found for: phalcon

So where am I going wrong?

Unfortunately Phalcon documentation install guide just doesn't work. Believe or not it's easier to compile phalcon extension from scratch.

I have a cookbook that I always use when create a new EC2 instance and have to install phalcon extension:

Installing php7.2 and some of its extensions

amazon-linux-extras install php7.2 -y
yum install php-bcmath php-gd php-mbstring php-pecl-mcrypt php-mysqlnd php-opcache php-pdo php-pecl-igbinary php-pgsql php-process php-soap php-xml php-xmlrpc -y

Installing some packages needed for compiling phalcon

yum install php-devel gcc libtool pcre-devel re2c -y
cd /tmp
yum install git -y

Installing phalcon 3.4.x since I'm not feeling 4.0 reliable enough

git clone https://github.com/phalcon/cphalcon
cd cphalcon/build
git checkout origin/3.4.x

This code is just in case you don't have enough RAM

/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=5120
chmod 600 /var/swap.1
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

Compiling phalcon. It may take several minutes

sudo ./install

Enabling phalcon extension

echo "; Enable phalcon extension module
extension=phalcon.so" >> /etc/php.d/50-phalcon.ini

Restarting services

service httpd restart
service php-fpm restart

Again, this commands are just if you don't have enough RAM

/sbin/swapoff /var/swap.1
rm -rf /var/swap.1

Hope it helps ;)

Here is my solution: using php 7.1 and phalcon 3.4.0

# Install PHP 7.1

yum install epel-release -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
yum-config-manager --enable remi-php71
yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql php-mbstring php-pecl-zip php-imap php-fpm php-intl -y

# Install Phalcon3.4 

yum install php-devel pcre-devel gcc make -y
curl -LO https://github.com/phalcon/cphalcon/archive/v3.4.0.tar.gz 
tar xzf v3.4.0.tar.gz && cd cphalcon-3.4.0/build 
sh install
echo "extension=phalcon.so" > /etc/php.d/phalcon.ini
cd ../.. && rm -rf v3.4.0.tar.gz cphalcon-3.4.0

Hope it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM