User Tools

Site Tools


php:buildphpapachenginxfromsource

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
php:buildphpapachenginxfromsource [2017/04/22 05:34] – [Memcache Admin] adminphp:buildphpapachenginxfromsource [2022/10/29 16:15] – 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 709: Line 720:
 </code> </code>
   - Step3: download and install depedency packages<code bash>   - Step3: download and install depedency packages<code bash>
-/onec/php/bin/php composer.phar composer.json+/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 1012: 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.txt · Last modified: 2024/10/28 05:24 by admin