User Tools

Site Tools


php:buildphpapachenginxfromsource

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

php:buildphpapachenginxfromsource [2017/04/18 10:03] – [script stop, start memcache] adminphp:buildphpapachenginxfromsource [2022/10/29 16:15] (current) – external edit 127.0.0.1
Line 5: Line 5:
 yum install gcc-c++ yum install gcc-c++
 yum install automake yum install automake
 +yum install make
 </code> </code>
 ===== Build and config PHP and Nginx ===== ===== Build and config PHP and Nginx =====
Line 240: Line 241:
  
 restart(){ restart(){
-        stop +    stop 
-        sleep 2 +    sleep 2 
-        start+    start
 } }
  
 rh_status(){ rh_status(){
-        status -p ${pidfile} $prog+    status -p ${pidfile} $prog
 } }
  
Line 278: Line 279:
 yum install libxml2-devel yum install libxml2-devel
 yum install libxslt-devel yum install libxslt-devel
 +yum install bison bison-devel
 </code> </code>
   * step2: Build libmcrypt: libmcrypt-2.5.8.tar.gz   * step2: Build libmcrypt: libmcrypt-2.5.8.tar.gz
Line 286: Line 288:
 </code> </code>
      
-  * step4: Build php-fpm (add option **--enable-fpm**)<code bash>+  * Step4:If you don't find file configure, run script below<code bash> 
 +./buildconf --force 
 +</code>  
 +  * step5: Build php-fpm (add option **--enable-fpm**)<code bash>
 tar zxvf php-5.3.28.tar.gz tar zxvf php-5.3.28.tar.gz
 cd php-5.3.28 cd php-5.3.28
Line 292: Line 297:
 make & make install make & make install
 cp php.ini-production /usr/local/php/etc/php.ini cp php.ini-production /usr/local/php/etc/php.ini
 +</code>
 +=== Build PHP7.4 with php-fpm ===
 +<code bash>
 +./configure --prefix=/onec/php7 --with-config-file-path=/onec/php7/etc --with-libdir=lib64 --enable-fpm --disable-rpath --disable-ipv6 --disable-safe-mode --enable-opcache --enable-calendar --enable-bcmath --enable-ftp --enable-soap --enable-shared --enable-mbstring --disable-mbregex --enable-magic-quotes --enable-sockets --with-openssl --with-zlib --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-zlib-dir=/usr --with-mysql --with-mysqli --without-sqlite3 --without-pdo-sqlite --with-pdo-mysql --with-pear --with-curl --with-curlwrappers --with-mcrypt=/usr/local
 +</code> option **--disable-mbregex** fix error:<code>
 +configure: error: Package requirements (oniguruma) were not met
 </code> </code>
 === Script start php-fpm === === Script start php-fpm ===
Line 563: Line 574:
 ===== Memcache ===== ===== Memcache =====
 ==== Build and Install Memcache server ==== ==== Build and Install Memcache server ====
-  - step1: Install missinge package<code>+  - step1: Install missing package<code>
 yum install libevent-devel yum install libevent-devel
 </code> </code>
-  - step2: download memcache<code>+  - step2: Download memcache<code>
 wget http://memcached.org/files/memcached-1.4.22.tar.gz wget http://memcached.org/files/memcached-1.4.22.tar.gz
 </code> </code>
-  - step3: buld and install<code bash>+  - step3: Build and install<code bash>
 tar xvf memcached-1.4.22.tar.gz tar xvf memcached-1.4.22.tar.gz
 cd memcached-1.4.22 cd memcached-1.4.22
Line 696: Line 707:
  
 exit $RETVAL exit $RETVAL
 +</code>
 +==== Memcache Admin ====
 +PHP memcache admin: https://github.com/clickalicious/phpmemadmin
 +
 +Below are steps to install and configure Memcache Admin:
 +  - Step1: download Memcache Admin source to **/onec/www/monitor/**:<code bash>
 +git clone https://github.com/clickalicious/phpmemadmin.git
 +</code> => source will be downloaded to /onec/www/monitor/phpmemadmin
 +  - Step2: Install composer in source directory:<code bash>
 +cd /onec/www/monitor/phpmemadmin
 +curl -sS https://getcomposer.org/installer | /onec/php/bin/php
 +</code>
 +  - Step3: download and install depedency packages<code bash>
 +/onec/php/bin/php composer.phar install
 +</code>
 +  - Step4: Go to directory app and copy .config.dist to .config:<code bash>
 +cd app
 +cp .config.dist .config
 +</code>
 +  - Step5: Change admin password in .config<code json>
 +{
 +  "username": "admin",
 +  "password": "pass",
 +  "timeout": -1,
 +  "cluster": {
 +    "name": "Cluster",
 +    "thresholds": {
 +        "notice": 50,
 +        "warning": 75,
 +        "error": 95
 +    },
 +    "hosts": [
 +      {
 +        "host": "127.0.0.1",
 +        "port": 11211
 +      }
 +    ]
 +  },
 +  "render": {
 +    "auto": true
 +  },
 +  "format": {
 +    "date": "Y-m-dTH:i:s"
 +  },
 +  "updatecheck": false
 +}
 +</code>
 +  - Step6: config nginx with php-fpm for run this website:<code>
 +server {
 +    listen       80;
 +    server_name  memcache.zplay.com;
 +    root   /onec/www/monitor/phpmemadmin/web;
 +
 +    index index.html index.htm index.php;
 +    fastcgi_index  index.php;
 +
 +    access_log /onec/nginx/logs/memcache.access_log;
 +    error_log /onec/nginx/logs/memcache.error_log;
 +
 +    error_page  404              /404.html;
 +    error_page 500 502 503 504  /50x.html;
 +
 +    location ~* "^.+\.(js|ico|gif|jpg|png|css|swf|htc|xml|bmp)$" {
 +        access_log  off;
 +        expires     7d;
 +    }
 +
 +    location / {
 +        index index.html index.php; ## Allow a static html file to be shown first
 +        try_files $uri $uri/ @handler; ## If missing pass the URI to zend framework's front handler
 +        expires 30d; ## Assume all files are cachable
 +    }
 +    location @handler { ## zend framework uses a common front handler
 +        rewrite / /index.php;
 +    }
 +    location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
 +        rewrite ^(.*.php)/ $1 last;
 +    }
 +    location ~ \.php$ {
 +      if (!-e $request_filename) { rewrite / /index.php last; }
 +      fastcgi_pass   127.0.0.1:9000;
 +      fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 +      include        fastcgi_params;
 +    }
 +}
 </code> </code>
 ===== Varnish Cache ===== ===== Varnish Cache =====
Line 998: Line 1094:
 session.name = PHPSESSID session.name = PHPSESSID
 session.save_path = "/tmp" session.save_path = "/tmp"
 +upload_max_filesize = 20M
 +post_max_size = 8M
 </code> </code>
 ==== PHP check ==== ==== PHP check ====
php/buildphpapachenginxfromsource.1492509800.txt.gz · Last modified: 2022/10/29 16:15 (external edit)