简体   繁体   中英

PHP-FPM NGinx Pthreads Linux installation

I'm trying to achieve multiple upload functionality (upload to multiple places at once). I successfully achieved this on windows (XAMPP + PThreads DLL's) but when installing PHP-FPM+php-pecl-pthreads.x86_64, and extending the Thread class i'm getting the error:

include(Thread.php): failed to open stream: No such file or directory

i tried adding all pthreads.so related to the php.ini:

/usr/lib64/php/modules/pthreads.so
/usr/lib64/php-zts/modules/pthreads.so
/usr/lib64/libpthread.so
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/32/libmudflapth.so
/lib64/libpthread-2.12.so

but i'm getting

undefined symbol: core_globals_id in Unknown on line 0

on my phpinfo i see thread safety is disabled.

Did anyone achieve this functionality and can shed some light on how to upload to multiple places at once / installing pthreads successfully on linux.

thanks, Danny

For debian/ubuntu

  1. download php source (make sure you have deb-src)

apt-get source php5

  1. go to that dir

cd php5*

  1. go to ext dir

cd ext

  1. download pthreads

git clone https://github.com/krakjoe/pthreads.git

  1. rebuild the configure settings

cd .. && ./buildconf --force

  1. ensure you have pthreads in configure options

./configure --help | grep pthre

  1. run configure (change the paths as appropriate for your setup)

./configure --enable-debug --enable-maintainer-zts --enable-pthreads --prefix=/usr --with-config-file-path=/etc --with-apxs2=/usr/bin/apxs2 --enable-fpm

  1. visit this for more info about user/group specific options if you need them.

make -j2

make -j2 install

  1. Now you will have php compiled with pthreads support. Verify this:

php -m | grep pthreads

  1. Make init script

copy sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

  1. change user and group to the username which nginx use in /etc/init.d/php-fpm .

service nginx restart

  1. Go to your nginx public foolder

cd <your-nginx-public-folder>

  1. touch phpinfo.php && echo "<?php phpinfo();" >> phpinfo.php

  2. go to your browser and search for pthreads in http://<your url>/phpinfo.php just created php file

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