centos7 php寮€鍙戠幆澧冨畨瑁?php
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 php寮€鍙戠幆澧冨畨瑁?php相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/ast' title='ast'>ast
zone groupadd exp jpeg system simple inter evelphp7.2 瀹夎
1.鍒涘缓杩愯鐢ㄦ埛
groupadd www
useradd -g www www
2.寤虹珛杞繛鎺?/p>
cp -frp /usr/lib64/libldap* /usr/lib/ ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/
3.缂栬瘧瀹夎php
tar -zxvf php-7.2.4.tar.gz cd php-7.2.4 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --with-libmbfl --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-pear --enable-maintainer-zts --with-ldap=shared --without-gdbm --with-apxs2=/usr/local/apache/bin/apxs make -j4 濡傛灉缂栬瘧鍑虹幇閿欒浣跨敤杩欎釜缂栬緫鍛戒护浠f浛make ZEND_EXTRA_LIBS=鈥?/span>-liconv鈥?/span> 涓嶈 make test 瀹虫浜虹瓑鏃堕棿澶暱 make install
4.閰嶇疆php閰嶇疆鏂囦欢
4.1 澶嶅埗闇€瑕佺殑閰嶇疆鏂囦欢:
cp php.ini-development /usr/local/php/etc/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
4.2閰嶇疆php.ini
expose_php = Off short_open_tag = ON max_execution_time = 300 max_input_time = 300 memory_limit = 128M post_max_size = 32M date.timezone = Asia/Shanghai #mbstring.func_overload=2 extension = "/usr/local/php/lib/php/extensions/no-debug-zts-20160303/ldap.so" [opcache] zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20160303/opcache.so opcache.memory_consumption=128 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 opcache.fast_shutdown=1 opcache.enable_cli=1 disable_functions=passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru
4.3閰嶇疆www.conf
鍙栨秷浠ヤ笅娉ㄩ噴骞朵慨鏀逛紭鍖栧叾鍙傛暟锛? listen = /var/run/www/php-cgi.sock listen.owner = www listen.group = www listen.mode = 0660 listen.allowed_clients = 127.0.0.1 pm = dynamic listen.backlog = -1 pm.max_children = 180 pm.start_servers = 50 pm.min_spare_servers = 50 pm.max_spare_servers = 180 request_terminate_timeout = 120 request_slowlog_timeout = 50 slowlog = var/log/slow.log
4.4鍒涘缓php-cgi.sock瀛樻斁鐩綍
mkdir /var/run/www/ chown -R www:www /var/run/www
4.6閰嶇疆php-fpm.conf
鍙栦笅浠ヤ笅娉ㄩ噴骞跺~鍐欏畬鏁磋矾寰勶細 pid = /usr/local/php/var/run/php-fpm.pid
4.7杩愯php-fpm
/usr/local/php/sbin/php-fpm
5.寮€鏈哄惎鍔?/p>
5.1 鍚姩鏂囦欢 vim /etc/systemd/system/php-fpm.service
5.2 鏂囦欢鍐呭
[Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] Type=simple PIDFile=/usr/local/php/var/run/php-fpm.pid ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf ExecReload=/bin/kill -USR2 $MAINPID ExecStop=/bin/kill -SIGINT $MAINPID [Install] WantedBy=multi-user.target
5.3鍚姩php-fpm
systemctl start php-fpm.service
5.4娣诲姞鍒板紑鏈哄惎鍔?/p>
systemctl enable php-fpm.service
6.鍚姩涓庡叧闂?/p>
systemctl enable php-fpm.service #寮€鏈鸿繍琛屾湇鍔? systemctl disable php-fpm.service #鍙栨秷寮€鏈鸿繍琛? systemctl start php-fpm.service #鍚姩鏈嶅姟 systemctl restart php-fpm.service #閲嶅惎鏈嶅姟
7.Php 鍔犲叆鐜鍙橀噺
1.灏?/usr/local/php/bin 鍔犲埌鍚庨潰,鐢?闅斿紑 vi /root/.bash_profile PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/lcoal/php/bin 2.閲嶅惎 source /root/.bash_profile
以上是关于centos7 php寮€鍙戠幆澧冨畨瑁?php的主要内容,如果未能解决你的问题,请参考以下文章