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

[经验分享] PHP在linux上编译安装手册

[复制链接]

尚未签到

发表于 2015-8-29 07:39:10 | 显示全部楼层 |阅读模式
  PHP在linux上编译安装手册
  一、 准备安装包
  Apache版本httpd-2.2.17.tar.gz
  PHP版本 php-5.3.5.tar.gz
  二、 安装apache
  先下载apache源代码包
  tar zvxf httpd-2.2.17.tar.gz
  cd httpd-2.2.6/
  ./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=all --enable-cgi
  make
  make install
  
  
  三、 安装PHP
  1、GD库安装
  安装GD库的时候需先安装zlib-1.2.3.tar.gz libpng-1.2.10.tar.bz2
  freetype-2.3.5.tar.gz libtool-2.2.6a.tar.gz jpegsrc.v6b.tar.gz
  这些库的支持。
  cd ..
  tar zvxf zlib-1.2.3.tar.gz
  cd zlib-1.2.3/
  CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib
  make
  make install
  cd ..
  tar zvxf libpng-1.2.10.tar.bz2
  cd libpng-1.2.10
  ./configure --prefix=/usr/local/libpng
  make
  make install
  cd ..
  tar zvxf freetype-2.3.5.tar.gz
  cd freetype-2.3.5
  ./configure --prefix=/usr/local/freetype
  make
  make install
  cd ..
  tar zvxf libtool-2.2.6a.tar.gz
  cd libtool-2.2.6
  ./configure --prefix=/usr/local/libtool
  make
  make install
  mkdir /usr/local/libjpeg
  mkdir /usr/local/libjpeg/include
  mkdir /usr/local/libjpeg/bin
  mkdir /usr/local/libjpeg/lib
  mkdir /usr/local/libjpeg/man
  mkdir /usr/local/libjpeg/man/man1
  cd ..
  tar zvxf jpegsrc.v6b.tar.gz
  cd jpeg-6b/
  \cp -rf /usr/local/libtool/share/libtool/config/config.* ./
  ./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static
  make
  make install
  cd ..
  tar zvxf gd-2.0.35.tar.gz
  cd gd-2.0.35
  ./configure --prefix=/usr/local/libgd --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/libjpeg
  make
  make install
  2、安装oracle客户端
  下载oracle客户端http://www.oracle.com/technetwork/topics/linuxsoft-082809.html
  下载的客户端版本要和系统对应
  sdk-10.2.0.4.0-linux-x86_64.zip
  basic-10.2.0.4.0-linux-x86_64.zip
  unzip sdk-10.2.0.4.0-linux-x86_64.zip
  unzip basic-10.2.0.4.0-linux-x86_64.zip
  mv instantclient_10_2 $HOME(这个是环境变量默认在/root,不存在可以设置);
  cd /$HOME/instantclient_10_2/
  ln -s /$HOME/instantclient_10_2/libclntsh.so.10.1 libclntsh.so(建立软连接)
  如果不建立软连接会在./configure的时候会报下面的错误。
  I'm too dumb to figure out where the libraries are in your Instant Client install
  如果是rpm包的安装方式可以不用建立软链接
  Vi /etc/profile
  export ORACLE_HOME=/root/instantclient_10_2
  3、PHP的安装
  './configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-config-file-path=/usr/local/php' '--with-gd=/usr/local/libgd' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local/freetype' '--with-jpeg-dir=/usr/local/libjpeg' '--with-png-dir=/usr/local/libpng/' '--with-zlib-dir=/usr/local/zlib' '--enable-xml' '--enable-mbstring' '--enable-sockets' '--enable-soap' '--with-pdo-oci=instantclient,/root/instantclient_10_2,10.2' '--with-oci8=instantclient,/root/instantclient_10_2' '--with-pdo-mysql=/usr/' '--with-mysql=/usr/'
  make
  make install
  拷贝php配置文件
  Php5.2
  cp php.ini-dist /usr/local/lib/php.ini
  php5.3
  cp php.ini-production /usr/local/php/php.ini
  4、apache配置文件的修改
  vi /usr/local/apache/conf/httpd.conf
  由于我们在 编译PHP时已经静态支持PHP5模块,因此无须加
  LoadModule php5_module lib/apache/libphp5.so
  再加入一行让apache正确处理apache文件
  AddType application/x-httpd-php .php
  再找到  DirectoryIndex关键字:添加 index.php
  开启.httaccess功能
  AllowOverride All
  5、 查看是否安装成功
  在web目录下建立文件phpinfo.php 输入代码
  <?php
  phpinfo();
  ?>
  访问http://192.168.0.252/phpinfo.php
  碰到的问题
  1、 在已经安装的版本上添加mcrypt模块
  这个加密模块要先安装libmcrypt-2.5.8.tar.gz 和 mhash-0.9.9.9.tar.gz(先安装前面的在安装这个)这两个扩展。
  cd php.5.**./ext/mcrypt /usr/local/php/bin/phpize
  ./configure --with-php-config=/usr/local/php/bin/php-config --with-mcrypt=/usr/local/
  make makeinstall
  2、 在安装好PHP5.3的时候
  Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in D:\Apache2.2\htdocs\upload\install\includes\lib_installer.php on line 223 5.2
  都不会不知道是不是5.3的都用设置默认时区。
  在php.ini中修改 date.timezone =Asia/Shanghai
  3、链接oracle一定要安装客户端
  安装客户端要注意版本版本。
  http://bbs.phpchina.com/thread-209587-1-1.html
  这里有一本oracle链接PHP的,很全面的书
  http://files.cnblogs.com/phpzxh/php_oracle.rar

运维网声明 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-105682-1-1.html 上篇帖子: php CI框架实现验证码功能和增强验证码安全性实战教程 下篇帖子: PHP界定符 <<
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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