在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
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的,很全面的书 https://files.cnblogs.com/phpzxh/php_oracle.rar |
2022-08-17
2022-11-06
2022-08-15
2022-08-18
2022-08-16
请发表评论