• ubuntu下php7安装及配置


    直接用apt-get 失败

    在官网下安装包http://tw2.php.net/get/php-7.0.18.tar.bz2/from/a/mirror

    进行make时 出现错误:

    libtool: link: `ext/opcache/ZendAccelerator.lo' is not a valid libtool object

    解决方法:make clean 后重新 make(原因不知)

    问题:不能通过/etc/init.d/php7.0-fpm start启动服务

    注意要结合apache

    ./configure --with-apxs2=/usr/local/apache2/bin/apxs

    ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre

    出现问题:没有apxs 

    解决方法:apt-get install apache2-dev

    (官网下载的安装包)

    编译httpd2.4.25

    出现问题:

    /usr/share/apr-1.0/build/libtool --silent --mode=link x86_64-linux-gnu-gcc -pthread -L/usr/local/lib -lssl -lcrypto
    -o ab ab.lo /usr/lib/x86_64-linux-gnu/libaprutil-1.la /usr/lib/x86_64-linux-gnu/libapr-1.la -lm
    ab.o: In function `main':

    ab.c:(.text+0x649c): undefined reference to `SSLv2_client_method'

    ab.c:(.text+0x6749): undefined reference to `CRYPTO_malloc_init'
    collect2: error: ld returned 1 exit status
    Makefile:73: recipe for target 'ab' failed
    make[2]: *** [ab] Error 1
    make[2]: Leaving directory '/usr/local/httpd-2.4.25/support'
    /usr/local/httpd-2.4.25/build/rules.mk:75: recipe for target 'all-recursive' failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory '/usr/local/httpd-2.4.25/support'
    /usr/local/httpd-2.4.25/build/rules.mk:75: recipe for target 'all-recursive' failed
    make: *** [all-recursive] Error 1

    (未解决)

    ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --with-ssl=/usr/local/openssl-1.0.1g(添加ssl的安装地址,但是由于我的openssl安装还是有问题编译还是有错误!!!!心累。。。)

    反正就是openssl有问题,所以决定重装!

    编译httpd2.2 能成功,但是在开启apache服务时出现加载不了libphp的问题,貌似是因为官方更改了数据结构名字unixd_config=>ap_unixd_config 

    ap_unixd_config is part of the core server, and the 
    symbol name differs between 2.2 and 2.4

    问题:

    httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp7.so into server: /usr/local/apache2/modules/libphp7.so: undefined symbol: ap_unixd_config

    没解决!

    Some newer PHP versions may not be compatible with Apache2.2. This error occurs because the function ap_unixd_config in Apache2.2 still called unix_config.

    Try to update your Apache to 2.4 if you need to use the newer PHP version, otherwise downgrade your PHP version to the previous one.

    问题:

    [Sat Apr 22 01:08:07.120960 2017] [:crit] [pid 46300:tid 139859197290368] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.

    apr和apr-util包含在Apache httpd的发行源代码中,并且在绝大多数情况下使用都不会出现问题。当然,如果apr或apr-util的1.0或1.1版本已经安装在你的系统中了,则必须将你的apr/apr-util升级到1.2版本,或者将httpd单独分开编译。要使用发行源代码中自带的apr/apr-util源代码进行安装,你必须手动完成
    下载地址:
    http://apr.apache.org/docs/apr/1.4/
    # 编译和安装 apr 1.5.1

    cd srclib/apr
    ./configure --prefix=/usr/local/apr-httpd/
    make
    make install

    # 编译和安装 apr-util apr-util-1.5.3

    cd ../apr-util-1.5.3

    ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr-httpd/
    make
    make install

    ##安装apache2.4.9

    cd httpd-2.4.9

    ./configure --prefix=/slview/apache --enable-rule=SHARED_CORE --enable-rule=SHARED_CHAIN --enable-module=so --enable-module=most --enable-shared=max --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util/

    make

    如报如下这种错:

    /slview/apache/include/apr_hooks.h:20:17: error: apu.h: No such file or directory

    可以把相关文件拷到:/slview/apache/include/ 如

     cp /opt/apr-util-1.5.3/include/* /slview/apache/include/

    再报这种错:

    -1 -DRESIN_HOME="/slview/resin" -I../common -g -O2 -DPOLL -DEPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -DHAS_SOCK_TIMEOUT -DHAS_JVMTI  -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread mod_caucho.c
    mod_caucho.c: In function 'write_env':
    mod_caucho.c:588: error: 'conn_rec' has no member named 'remote_ip'
    mod_caucho.c:590: error: 'conn_rec' has no member named 'remote_ip'
    mod_caucho.c:591: error: 'conn_rec' has no member named 'remote_addr'
    mod_caucho.c: In function 'caucho_request':
    mod_caucho.c:897: error: 'conn_rec' has no member named 'remote_ip'
    make[2]: *** [mod_caucho.lo] 错误 1

    则需要修改:/slview/resin/modules/c/src/apache2/mod_caucho.c

    将其中有三处的remote_ip修改成client_ip,如果存在remote_addr也应修改成client_addr

    2.2升到2.4时需要注意事项:

    • 模块mod_authn_default, mod_authz_default, mod_mem_cache已经移除,如果在2.2版本使用mod_mem_cache模块,在2.4中使用mod_cache_disk. 所有负载均衡实现已经移动到了单独的,自包含的mod_proxy子模块中,如mod_lbmethod_bybusyness.如果在配置文件中使用这些模块,可能需要进行编译和加载.
    • 对BeOS,TPF和更老的平台,如A/UX,Next和Tandem的支持已经移除.
    • 默认编译动态模块
    • 默认只加载模块的一个基本子集,其它的被注释掉了
    • 默认编译most模块设定
    • the “reallyall” module set adds developer modules to the “all” set
    • apr和apr-util没有打包在httpd 2.4里面.你可以选择已经安装的版本或者下载apr和apr-util,然后解压apr/apr-util到./srclib目录,使用–with-included-apr参数进行编译

    2.运行时配置变化

    • 包含认证配置方面的显著变化和其它一些小变化,认证配置方面的变化在常见问题中讲.其它小变化包括:
    • MaxRequestsPerChild重命名为MaxConnectionsPerChild,描述更加准确.
    • MaxClients重命名为MaxRequestWorkers,描述更加准确.对于异步MPM,如event,最大客户端数量不等于工作线程数量.旧的名字仍然支持.
    • DefaultType设定项不再产生作用,如果你用了,只会产生一个警告,使用其它设置进行替换.
    • EnableSendfile现在默认关闭.
    • FileETag现在默认为”MTime Size” (without INode).
    • mod_log_config: ${cookie}C matches whole cookie names. Previously any substring would match.
    • mod_dav_fs: The format of the DavLockDB file has changed for systems with inodes. The◇◇ DavLockDB file must be deleted on upgrade.
    • KeepAlive only accepts values of On or Off. Previously, any value other than “Off” or “0″ was treated as “On”.
    • Directives AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex, and WatchdogMutexPath have been replaced with a single Mutex directive. You will need to evaluate any use of these removed directives in your 2.2 configuration to determine if they can just be deleted or will need to be replaced using Mutex.
    • mod_cache: CacheIgnoreURLSessionIdentifiers now does an exact match against the query string instead of a partial match. If your configuration was using partial strings, e.g. using sessionid to match /someapplication/image.gif;jsessionid=123456789, then you will need to change to the full string jsessionid.
    • mod_ldap: LDAPTrustedClientCert is now consistently a per-directory setting only. If you use this directive, review your configuration to make sure it is present in all the necessary directory contexts.
    • mod_filter: FilterProvider syntax has changed and now uses a boolean expression to determine if a filter is applied.
    • mod_include:
    • The #if expr element now uses the new expression parser. The◇◇ syntax can be restored with the new directive SSILegacyExprParser.
    • An SSI* config directive in directory scope no longer causes all other per-directory SSI* directives to be reset to their default values.
    • mod_charset_lite: The DebugLevel option has been removed in favour of per-module LogLevel configuration.
    • mod_ext-filter: The DebugLevel option has been removed in favour of per-module LogLevel configuration.
    • mod_ssl: CRL based revocation checking now needs to be explicitly configured through SSLCARevocationCheck.
    • mod_substitute: The maximum line length is now limited to 1MB.
    • mod_reqtimeout: If the module is loaded, it will now set some default timeouts.

    3.其它杂项

    • mod_autoindex: will now extract titles and display descriptions for .xhtml files, which were previously ignored.
    • mod_ssl: The default format of the *_DN variables has changed. The◇◇ format can still be used with the new LegacyDNStringFormat argument to SSLOptions. The SSLv2 protocol is no longer supported.
    • htpasswd now uses MD5 hash by default on all platforms.
    • The NameVirtualHost directive no longer has any effect, other than to emit a warning. Any address/port combination appearing in multiple virtual hosts is implicitly treated as a name-based virtual host.
    • mod_deflate will now skip compression if it knows that the size overhead added by the compression is larger than the data to be compressed.
    • Multi-language error documents from 2.2.x may not work unless they are adjusted to the new syntax of mod_include’s #if expr= element or the directive SSILegacyExprParser is enabled for the directory containing the error documents.

    4.第三方模块

    • 所有模块在加载前必须重新编译.

    2.2升级2.4升级过程中的常见问题

    在2.2升级2.4的时候,因为有一些模块没有用了,又新加了一些模块,因此可能提示错误。以下是常见错误的解决方法。

    Startup errors(启动错误)

    错误提示:  Invalid command ‘User’

    1
    Invalid command 'User', perhaps misspelled or defined by a module not included in the server configuration

    解决办法: 加载模块:mod_unixd,在httpd.conf中添加:

    1
    LoadModule unixd_module modules/mod_unixd.so

    错误提示:  Invalid command ‘Require’

    1
    Invalid command 'Require', perhaps misspelled or defined by a module not included in the server configuration

    或者:

    1
    Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration

    解决办法有两种:
    第一种:加载兼容模块 mod_access_compat ,在 httpd.conf 中添加:

    1
    LoadModule access_compat_module modules/mod_access_compat.so

    第二种:更新配置文件到2.4版本的语法.

    包括以下两步:
    第一步:加载相应模块,在 httpd.conf 中添加:

    1
    2
    LoadModule authz_core_module modules/mod_authz_core.so
    LoadModule authz_host_module modules/mod_authz_host.so

    第二步:修改配置文件语法,此处举几个例子:
    2.2 版本:

    1
    2
    Order deny,allow
    Deny from all

    2.4 版本:

    1
    Require all denied

    2.2 版本:

    1
    2
    Order allow,deny
    Allow from all

    2.4 版本:

    1
    Require all granted

    2.2 版本:

    1
    2
    3
    Order Deny,Allow
    Deny from all
    Allow from example.org

    2.4 版本:

    1
    Require host example.org

    错误提示:   Ignoring deprecated use of DefaultType

    1
    Ignoring deprecated use of DefaultType in line NN of /path/to/httpd.conf

    解决办法:移除 DefaultType ,使用其它配置设置.

    在处理请求时的错误

    错误提示:  configuration error: couldn’t check user: /path

    1
    configuration error: couldn't check user: /path

    解决办法:加载模块: mod_authn_core . 加载方法与上面讲的类似.

  • 相关阅读:
    Spring AOP (下)
    C#和C++性能差距巨大,在高耗能和低性能设备上强烈建议不要使用
    [MOSS]Microsoft Office SharePoint Server 2007 安装与配置
    [MOSS]使用Microsoft Office SharePoint Server 2007过程中遇到的问题与解决方法
    博客索引
    springweb里面的post和get请求
    Nginx 之在windows下的安装与启动
    某外企招聘程序员部分面试题,求作答!!!
    解决Asp.net Web网站发布到服务器上运行时,某界面传参数过多,造成的“此请求的查询字符串的长度超过配置的 maxQueryStringLength 值”错误。
    使用”Sql Server 代理“下的”作业“定时执行期望的任务
  • 原文地址:https://www.cnblogs.com/junglefish/p/6745123.html
Copyright © 2020-2023  润新知