Skip to content

Instantly share code, notes, and snippets.

@tanmay27vats
Last active May 28, 2018 04:39
Show Gist options
  • Save tanmay27vats/d2bfdcf1dacfeb2a8dea17f8b469dab7 to your computer and use it in GitHub Desktop.
Save tanmay27vats/d2bfdcf1dacfeb2a8dea17f8b469dab7 to your computer and use it in GitHub Desktop.
Install pthreads (Multithreading) on Amazon AWS EC2 server having PHP version 5.6.x
#Install pthreads on AWS-EC2 with php5.6
#!/usr/bin/env bash
sudo yum update -y
sudo yum install httpd
cd
wget https://mirror.webtatic.com/yum/el6/latest.rpm
sudo yum install latest.rpm -y
sudo yum-config-manager --enable webtatic
sudo yum clean all
sudo yum install --enablerepo=webtatic php56w php56w-bcmath php56w-gd php56w-imap php56w-mbstring php56w-mcrypt php56w-mysqlnd php56w-pear php56w-xml php56w-soap php56w-devel -y
sudo yum install php56w-fpm php56w-opcache -y #thread safety
sudo service httpd restart
pecl download pthreads-2.0.10
tar zxvf pthreads-2.0.10.tgz
cd pthreads-2.0.10
zts-phpize
./configure --with-php-config=/usr/bin/zts-php-config
make
sudo cp modules/pthreads.so /usr/lib64/php-zts/modules/
sudo vim /etc/sysconfig/httpd # enable worker mode
## If 'httpd' file opened via above line do not have 'LoadModule'. Then try this.
cd /etc/httpd/conf.modules.d
ls
## You'll find a file called: 00-mpm.conf
## You can uncomment only one out of those 3 lines:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
#LoadModule mpm_worker_module modules/mod_mpm_worker.so
#LoadModule mpm_event_module modules/mod_mpm_event.so
## More informations here : https://httpd.apache.org/docs/2.4/mpm.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment