centos編譯安裝php7

來源:互聯網
上載者:User

標籤:charset   啟用   variable   路徑   mon   strong   收集器   sid   off   

1.安裝依賴軟體庫:

  yum install -y libxml2 libxml2-devel libtool* curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel

 

2.下載php7源碼包進行編譯安裝

   [[email protected] opt]# wget http://cn2.php.net/distributions/php-7.0.14.tar.gz

   [[email protected] opt]# tar xf php-7.0.14.tar.gz

   [[email protected] opt]# cd  php-7.0.14
   [[email protected] opt]#  ./configure --prefix=/usr/local/php-7.0.14 --enable-fpm --enable-opcache --with-config-file-path=/usr/local/php-7.0.14/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-static --enable-sockets --enable-wddx --enable-zip --enable-calendar --enable-bcmath --enable-soap --with-zlib --with-iconv --with-freetype-dir --with-gd --with-jpeg-dir --with-xmlrpc --enable-mbstring --with-sqlite3 --with-curl --enable-ftp --with-mcrypt --with-openssl --disable-safe-mode --with-gettext

 

3.設定檔php.ini

[PHP]engine = On #是否啟用php解析引擎short_open_tag = On #是否使用簡介標誌precision = 14 #浮點數中顯示有效數位位元output_buffering = 4096 #輸出緩衝區的大小zlib.output_compression = Off #是否開啟zlib輸出壓縮implicit_flush = Off #unserialize_callback_func = #serialize_precision = 17 disable_functions = #disable_classes = #zend.enable_gc = On #啟用循環參考收集器。expose_php = On #max_execution_time = 300 #程式執行最大時間,預設為30s,0表示沒有時間限制,這裡設定300s,可以自訂設定max_input_time = 300 memory_limit = 128M error_reporting = E_ALL display_errors = Off display_startup_errors = On php有錯誤出理,就會提示,而且在事件檢視器中有記錄。如果設定為display_startup_errors = Off,則不會有任何提示log_errors = On log_errors_max_len = 1024 error_log=/data/log/php/error_php7.log 設定錯誤記錄檔檔案儲存路徑ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On track_errors = On html_errors = On variables_order = "GPCS" 此指令描述了PHP註冊GET, POST, Cookie, 環境 和 內建變數的順序 (各自使用G, P, C, E 和 S , 一般使用 EGPCS 或 GPC). 註冊使用從左往右的順序, 新的值會覆蓋舊的值request_order = "GP" register_argc_argv = Off auto_globals_jit = On post_max_size = 16M auto_prepend_file = auto_append_file = default_mimetype = "text/html"default_charset = "UTF-8"doc_root = user_dir = enable_dl = Off file_uploads = On upload_max_filesize = 2M max_file_uploads = 20 allow_url_fopen = On allow_url_include = Off default_socket_timeout = 60 cgi.fix_pathinfo= 1 [CLI Server]cli_server.color = On[Date]date.timezone = Asia/Shanghai 設定地區時間[Pdo_mysql]pdo_mysql.cache_size = 2000 pdo_mysql.default_socket= 預設的socket時間[Phar][mail function] 郵件功能SMTP = localhost smtp_port = 25 mail.add_x_header = On 是否開啟最大的header [SQL]sql.safe_mode = Off 對於每個不同資料庫的串連函數,其預設值請參考相應的手冊頁面。[ODBC]odbc.allow_persistent = Onodbc.check_persistent = Onodbc.max_persistent = -1odbc.max_links = -1odbc.defaultlrl = 4096odbc.defaultbinmode = 1[Interbase]ibase.allow_persistent = 1ibase.max_persistent = -1ibase.max_links = -1ibase.timestampformat = "%Y-%m-%d %H:%M:%S"ibase.dateformat = "%Y-%m-%d"ibase.timeformat = "%H:%M:%S"[MySQLi]mysqli.max_persistent = -1 mysqli.allow_persistent = On mysqli.max_links = -1 mysqli.cache_size = 2000 mysqli.default_port = 3306 mysqli.default_socket = mysqli.default_host = mysqli.default_user = mysqli.default_pw = mysqli.reconnect = Off [mysqlnd]mysqlnd.collect_statistics = Onmysqlnd.collect_memory_statistics = On[PostgreSQL]pgsql.allow_persistent = On pgsql.auto_reset_persistent = Off pgsql.max_persistent = -1 pgsql.max_links = -1 pgsql.ignore_notice = 0 pgsql.log_notice = 0[bcmath]bcmath.scale = 0[Session]session.save_handler = files session.use_strict_mode = 0session.use_cookies = 1 session.use_only_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = cookie的有效網域名稱session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000session.gc_maxlifetime = 1440session.referer_check =session.cache_limiter = nocachesession.cache_expire = 180session.use_trans_sid = 0session.hash_function = 0session.hash_bits_per_character = 5url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"[Assertion]zend.assertions = 1[Tidy]tidy.clean_output = Off[soap]soap.wsdl_cache_enabled=1soap.wsdl_cache_dir="/tmp"soap.wsdl_cache_ttl=86400soap.wsdl_cache_limit = 5[sysvshm][ldap]ldap.max_links = -1 4.進程服務的設定檔php-fpm,把php-fpm引入www.conf檔案中的配置[[email protected] etc]# cat /usr/local/php-7.0.14/etc/php-fpm.confinclude=/usr/local/php-7.0.14/etc/php-fpm.d/*.conf [[email protected] etc]# vim /usr/local/php-7.0.14/etc/php-fpm.d/www.conf[global] 全域定義log_level = notice 錯誤層級. 可用層級為: alert(必須立即處理), error(錯誤情況), warning(警告情況), notice(一般重要訊息), debug(調試資訊). 預設: notice.error_log=/data/log/php/error_php-fpm7.log 錯誤記錄檔檔案儲存路徑[www] 定義www的pooluser = www 啟動進程的帳戶group = www 啟動進程組listen = 127.0.0.1:9999 fpm監聽連接埠,即nginx中php處理的地址pm = dynamic pm的模式,分為static|dynamic兩種pm.max_children = 50 子進程最大數pm.start_servers = 10 啟動時的進程數pm.min_spare_servers = 10 保證空閑進程數最小值,如果空閑進程小於此值,則建立新的子進程pm.max_spare_servers = 50 保證空閑進程數最大值,如果空閑進程大於此值,此進行清理5.複製服務控制指令碼php-fpm到系統服務指令碼目錄:cp /opt/php-7.0.14/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm7 && chmod 755 /etc/init.d/php-fpm7設定php7開啟啟動:chkconfig --add php-fpm7chkconfig php-fpm7 on啟動php:service php-fpm7 start  

centos編譯安裝php7

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.