نمایش نتایج: از شماره 1 تا 1 , از مجموع 1

موضوع: آموزش نصب و کانفیگ php-fpm در دایرکت ادمین

  1. #1
    موسس و مدیر
    نمی‌دانم در کدامین کوچه جستجویت کنم ؟ آسوده بخواب مادر بیمارم
    تاریخ عضویت
    Feb 2010
    محل سکونت
    13 78 57
    نوشته ها
    13,577
    تشکر تشکر کرده 
    15,753
    تشکر تشکر شده 
    17,227
    تشکر شده در
    4,905 پست
    حالت من : Khoonsard
    قدرت امتیاز دهی
    24982
    Array

    پیش فرض آموزش نصب و کانفیگ php-fpm در دایرکت ادمین

    One requirement for this instruction to work is you need PHP 5.3. I have tried to patch PHP 5.2.17 according to PHP-FPM website but it didn't work. After tried to patch it so many times, I decided to upgrade to PHP 5.3.5 and it works correctly now.

    Also, when compile PHP-FPM, you will get 2 PHP files. One is "php" which is for CLI mode and "php-fpm" which is PHP-FPM. "php-cgi" file won't be compiled until you removed "--enable-fpm" from configuration. That means... if you want to have the rest of Virtualhosts to run with mod_fcgid (php-cgi) with PHP 5.2, you can still do that. Just make sure to upgrade directly to PHP 5.3 and PHP-FPM at the same time. Always have "--enable-fpm" in configuration file for PHP to compile. That way, "php-cgi" will not compile in PHP version 5.3. So, all websites run with mod_fcgid that still use "php-cgi" file still run in PHP 5.2.
    In case you need all of them to run in PHP 5.3. You need to compile PHP twice, one with "--enable-fpm" and one without it.
    1. Enable PHP-FPM and compile PHP.
    1.1 Copy "configure.php5" for custom compile

    • mkdir -p /usr/local/directadmin/custombuild/custom/suphp
    • cp /usr/local/directadmin/custombuild/configure/suphp/configure.php5 /usr/local/directadmin/custombuild/custom/suphp

    1.2 Edit configure.php5

    • nano -w /usr/local/directadmin/custombuild/custom/suphp/configure.php5

    add "--enable-fpm" into the file. After edit, the "configure.php5" will look like below :

    • #!/bin/sh
    • "./configure" \
    • "--prefix=/usr/local/php5" \
    • "--enable-force-cgi-redirect" \
    • "--enable-fastcgi" \
    • "--with-config-file-path=/usr/local/etc/php5/cgi" \
    • "--with-curl=/usr/local/lib" \
    • "--with-gd" \
    • "--with-gettext" \
    • "--with-jpeg-dir=/usr/local/lib" \
    • "--with-freetype-dir=/usr/local/lib" \
    • "--with-kerberos" \
    • "--with-mcrypt" \
    • "--with-mhash" \
    • "--with-mysql=/usr" \
    • "--with-mysqli=/usr/bin/mysql_config" \
    • "--with-pcre-regex=/usr/local" \
    • "--with-pdo-mysql=/usr" \
    • "--with-pear=/usr/local/lib/php" \
    • "--with-png-dir=/usr/local/lib" \
    • "--with-zlib" \
    • "--with-zlib-dir=/usr/local/lib" \
    • "--with-openssl" \
    • "--with-iconv=/usr/local" \
    • "--enable-bcmath" \
    • "--enable-calendar" \
    • "--enable-exif" \
    • "--enable-ftp" \
    • "--enable-gd-native-ttf" \
    • "--enable-magic-quotes" \
    • "--enable-soap" \
    • "--enable-sockets" \
    • "--enable-mbstring" \
    • "--enable-zip" \
    • "--enable-wddx" \
    • "--enable-fpm"

    1.3 Compile PHP

    • cd /usr/local/directadmin/custombuild
    • ./build php n

    Note : If you get error while compile, you may need to run " .build clean " and then try to compile again.
    1.4 After compiled, you will see where PHP-FPM file located as below :

    • .....
    • Make Complete
    • Copying php.ini..
    • /usr/local/etc/php5/cgi/php.ini already exists, skipping.
    • Installing php...
    • Installing PHP SAPI module: fpm
    • Installing PHP CLI binary: /usr/local/php5/bin/
    • Installing PHP CLI man page: /usr/local/php5/man/man1/
    • Installing PHP FPM binary: /usr/local/php5/sbin/
    • Installing PHP FPM config: /usr/local/php5/etc/
    • Installing PHP FPM man page: /usr/local/php5/man/man8/
    • Installing build environment: /usr/local/php5/lib/php/build/
    • Installing header files: /usr/local/php5/include/php/
    • Installing helper programs: /usr/local/php5/bin/
    • program: phpize
    • program: php-config
    • Installing man pages: /usr/local/php5/man/man1/
    • page: phpize.1
    • page: php-config.1
    • Installing PEAR environment: /usr/local/lib/php/
    • .....

    2. Now, Create Init script file
    2.1 Copy file from source

    • cp /usr/local/directadmin/custombuild/php-5.3.5/sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm
    • chmod 755 /etc/init.d/php-fpm

    2.2 Edit php.fpm init script file as below:

    • nano -w /etc/init.d/php-fpm

    Edit php.fpm file FROM :

    • .....
    • prefix=@prefix@
    • exec_prefix=@exec_prefix@
    • php_fpm_BIN=@sbindir@/php-fpm
    • php_fpm_CONF=@sysconfdir@/php-fpm.conf
    • php_fpm_PID=@localstatedir@/run/php-fpm.pid
    • php_opts="--fpm-config $php_fpm_CONF"
    • .....

    TO :

    • .....
    • prefix=/usr/local/php5
    • exec_prefix=${prefix}
    • php_fpm_BIN=/usr/local/php5/sbin/php-fpm
    • php_fpm_CONF=/usr/local/php5/etc/php-fpm.conf
    • php_fpm_PID=/var/run/php-fpm.pid
    • php_opts="--fpm-config $php_fpm_CONF"
    • .....

    You may need to run command below to have PHP-FPM run automatically when start up (After reboot or turn on the machine) :

    • /sbin/chkconfig php-fpm on

    2.3 Edit PHP-FPM configuration file to match your need. My example below is just to make it work but you can adjust to whatever you like :

    • nano -w /usr/local/php5/etc/php-fpm.conf

    Below is my "php-fpm.conf" configuration :

    • [global]
    • pid = /var/run/php-fpm.pid
    • error_log = /var/log/php-fpm.log
    • [admin]
    • listen = /fcgi/admin/public_html/admin.sock
    • listen.owner = $pool
    • listen.group = $pool
    • listen.mode = 0666
    • user = $pool
    • group = $pool
    • pm = dynamic
    • pm.max_children = 50
    • pm.start_servers = 3
    • pm.min_spare_servers = 3
    • pm.max_spare_servers = 10
    • php_admin_value[open_basedir] = /home/$pool/:/tmp:/var/tmp:/var/www/html

    Note 1 : $pool is variable which will replaced by the data from the bracket. Here, that is "admin".
    Note 2 : php_admin_value[open_basedir] is not require but suggested. Also, without "/var/www/html", you won't be access your webmail or anything through domain name. However, you can still access webmail or anything through IP Address.

    2.4 Try to start / stop / restart PHP-FPM

    • service php-fpm start
    • service php-fpm stop
    • service php-fpm restart

    Note :

    1. To have PHP-FPM compiled and configured in this tutorial doesn't mean you already using it. It just means you already have PHP-FPM ready to use. You need to check my tutorial [HOW-TO] DirectAdmin - Run Apache with "mod_fcgid on PHP 5.2 / 5.3" and "mod_fastcgi + PHP-FPM on 5.3" on the same server that will be post soon.

    Source :
    - PHP: FastCGI Process Manager (FPM) - Manual
    - The Life and Times of Michael Shadle » Cleanest configuration for the new PHP-FPM?
    - Home - PHP-FPM



    Good luck
    زندگی در بردگی شرمندگی است * معنی آزاد بودن زندگی است
    سر که خم گردد به پای دیگران * بر تن مردان بود بار گران




  2. کاربر مقابل از Mohamad عزیز به خاطر این پست مفید تشکر کرده است:


علاقه مندی ها (بوک مارک ها)

علاقه مندی ها (بوک مارک ها)

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست در پست خود ضمیمه کنید
  • شما نمیتوانید پست های خود را ویرایش کنید
  •  

http://www.worldup.ir/