设为首页 收藏本站
查看: 1099|回复: 0

[经验分享] ubuntu下安装apache 2.4.6

[复制链接]

尚未签到

发表于 2018-11-24 07:10:51 | 显示全部楼层 |阅读模式
  1、apr安装
  cd apr
  ./configure --prefix=/usr/local/apr/ && make && make install
  2、apr-util安装
  cd ../apr-util
  ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/ && make && make install
  3、pcre安装
  cd pcre-8.10
  ./configure --prefix=/usr/local/pcre && make && make install
  4、openssl安装
  ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl&&make && make install
  可能会提示
  You need a C++ compiler.
  解决办法:
  执行sudo apt-get install build-essential
  Ubuntu并没有提供C/C++的编译环境,因此还需要手动安装。
  如果想在Ubuntu中编译c/c++程序,只需要安装该软件包就可以了
  ldap模块安装
  如果不知道哪些apache模块跟ldap有关,我们可以使用这个命令找到相关模块:
  sudo apt-cache search apache2 ldap
  apt-get install 安装上面找到的模块
  4 http 2.4.6安装
  加入--with-included-apr  编译必须把apr,apr-util 的源文件放到 apache2.4.3源码的srclib目录下,并修改apr源码目录为apr,apr-util源码目录为apr-util
  cp -rf apr-1.4.3 ./srclib/apr
  cp -rf apr-util-1.4.1 ./srclib/apr-util
  ./configure  --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-speling --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-ssl --with-ssl=/usr/local/openssl/ --enable-rewrite --enable-so --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --with-included-apr --with-mpm=worker --enable-authnz-ldap --enable-proxy-balancer --enable-proxy--enable-proxy-http --enable-proxy-ftp   --enable-ssl
  make && make install
  5 .安装php
  ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/local/libxml2 --with-config-file-path=/usr/local/php/etc --with-mysql   --with-mysqli --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap
  安装完从源码复制 php.ini 到安装目录 /usr/local/php/lib
  安装完成检查http.conf是否有
  LoadModule php5_module        modules/libphp5.so
  这行
  添加下面两行
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
  
  DirectoryIndex index.php index.html
  
  禁止浏览目录
  Options   FollowSymLinks
  编写php测试页面
  
  可能会报错 缺少libxml2
  解决方法:下载源码按装
  ./configure --prefix=/usr/local/libxml2 --disable-static --with-history &&make
  
  安装libxml2可能报错        没有python.h这个目录
  解决方法:apt-get install  python-dev
  
  
  
不出意外,最后应该会看到以下结果:  

  
+--------------------------------------------------------------------+
  | License: |
  | This software is subject to the PHP License, available in this |
  | distribution in the file LICENSE. By continuing this installation |
  | process, you are bound by the terms of this license agreement. |
  | If you do not agree with the terms of this license, you must abort |
  | the installation process at this point. |
  +--------------------------------------------------------------------+
  

  
Thank you for using PHP.
  

编译常见问题
  错误一:
  configure: error: xml2-config not found. Please check your libxml2 installation.
  而我已经安装过了libxml2,但是还是有这个提示:
  解决办法:
# sudo apt-get install libxml2-dev  错误二:
  configure: error: Please reinstall the BZip2 distribution
  而我也已经安装了bzip2,网上找到得解决方案都是需要安装bzip2-dev,可是11.10里面没有这个库。
  解决办法:在网上找到bzip2-1.0.5.tar.gz,解压,直接make ,sudo make install.(我使用的该源来自于http://ishare.iask.sina.com.cn/f/9769001.html)
  错误三:
  configure: error: Please reinstall the libcurl distribution -easy.h should be in /include/curl/
  解决办法:
# sudo apt-get install libcurl4-gnutls-dev  错误四:
  configure: error: jpeglib.h not found.
  解决办法:
# sudo apt-get install libjpeg-dev  错误五:
  configure: error: png.h not found.
  解决办法:
# sudo apt-get install libpng-dev  错误六:
  configure: error: libXpm.(a|so) not found.
  解决办法:
# sudo apt-get install libxpm-dev  错误七:
  configure: error: freetype.h not found.
  解决办法:
# sudo apt-get install libfreetype6-dev  错误八:
  configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.
  解决办法:
# sudo apt-get install libt1-dev   错误九:
  configure: error: mcrypt.h not found. Please reinstall libmcrypt.
  解决办法:
# sudo apt-get install libmcrypt-dev  错误十:
  configure: error: Cannot find MySQL header files under yes.
  Note that the MySQL client library is not bundled anymore!
  解决办法:
# sudo apt-get install libmysql++-dev  错误十一:
  configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
  解决办法:
# sudo apt-get install libxslt1-dev  可见PHP源码安装之前需要先安装这些依赖,详细可见http://forum.ubuntu.org.cn/viewtopic.php?f=88&t=231159
  如上错误都解决之后,再次./config….没有错误之后,
# make# sudo make install
make
  //编译源码,漫长的一个过程,休息下先去喝杯茶再回来
成功后会看到:Build complete.  Don't forget to run 'make test'.
  

  

make install
  如果安装成功,就此php源码编译成功;
  
  
  



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-638802-1-1.html 上篇帖子: APACHE默认模块功能说明 下篇帖子: 基于Apache+Subversion安装配置与管理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表