10.1.0.8服务器,安装php5.5.12过程(最终完成,但中间有先前的错误步骤)

1026  scp root@10.1.0.6:/home/bruce/tools/php-5.5.12.tar.gz /home/bruce/tools/
1027  ls
1028  tar zxvf php-5.5.12.tar.gz
1029  cd php-5.5.12
1030  ls
1031  cd /usr/local/
1032  ls
1033  cd –
1034  ls
1035  ./configure –prefix=/usr/local/php –enable-inline-optimization –disable-debug –disable-rpath –enable-shared –enable-opcache –enable-fpm –with-apxs2=/usr/local/httpd/bin/apxs
–with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-gd –enable-gd-native-ttf –with-fpm-user=www –with-fpm-group=www –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-gettext –enable-mbstring –with-iconv –with-mcrypt –with-mhash –with-openssl –enable-bcmath –enable-soap –with-libxml-dir –enable-pcntl –enable-shmop –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-sockets –with-curl –with-zlib –enable-zip –with-bz2 –with-readline –with-jpeg-dir=/usr/lib –with-png-dir=/usr/lib
1036  make
1037  ls
1038  vi Makefile
1039  make
1040  cd /usr/local/lib
1041  ls
1042  cd /etc/
1043  ls
1044  vi ld.so.conf
1045  ldconfig
1046  sudu ldconfig
1047  ldconfig
1048  cd /home/bruce/tools/php-5.5.12
1049  make
1050  make test
1051  make
1052  make clean
1053  make
1054  make install
1055  cd /usr/local/
1056  ls
1057  cd php/
1058  ls
1059  cd bin/
1060  ls
1061  cd ..
1062  ls
1063  cd php/
1064  ls
1065  cd –
1066  cd /home/bruce/tools/
1067  ls
1068  cd php-5.5.12
1069  ls
1070  cd /usr/local/httpd
1071  ls
1072  cd build/
1073  ls
1074  ll
1075  cd cd /home/bruce/tools/php-5.5.12
1076   cd /home/bruce/tools/php-5.5.12
1077  cdls
1078  ls
1079  cd libs/
1080  ls
1081  libtool –finish
1082  cd /usr/local/
1083  ls
1084  cd php/
1085  ls
1086  vi /etc/httpd2.4.18/httpd.conf
1087  cd /etc/php
1088  cd /etc/
1089  ls
1090  cd /home/bruce/tools/php-5.5.12
1091  ls
1092  cd /usr/local/php/lib/ls
1093  cd /usr/local/php/lib/
1094  ls
1095  cd php/
1096  ls
1097  cd –
1098  cd /home/bruce/tools/php-5.5.12
1099  ls
1100  cp php.ini-production /usr/local/php/lib/php.ini
1101  ls
1102  cd /usr/local/php/
1103  ls
1104  cd etc/
1105  ls
1106  cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
1107  ls
1108  cd –
1109  cd /home/bruce/tools/php-5.5.12
1110  ls
1111  cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
1112  chmod +x /etc/init.d/php-fpm
1113  service php-fpm start
1114  netstat -lnt
1115  top
1116  /usr/local/php/bin/php -v
1117  export PATH=$PATH:/usr/local/php/bin
1118  php -v
1119  service php-fpm stop
1120  cd /usr/local/httpd
1121  ls
1122  cd htdocs/
1123  ls
1124  vi index.php
1125  cd /etc/httpd2.4.18/
1126  vi httpd.conf
1127  cd /usr/local/php/lib/
1128  ls
1129  cd php
1130  ls
1131  cd /etc/httpd2.4.18/
1132  vi httpd.conf
1133  ls
1134  ll
1135  /usr/local/httpd/bin/apachectl -t
1136  /usr/local/httpd/bin/apachectl graceful
1137  scp root@10.1.0.6:/home/bruce/tools/www333.zip /usr/local/httpd/htdocs/

Linux下PHP扩展pdo_mysql和mysqli

问题见:http://www.thinkphp.cn/topic/28755.html

解决方案如下:

1.进入PHP源码包ext/pdo目录

cd ext/pdo

2.执行/usr/local/php/bin/phpize[假设PHP的安装目录为/usr/local/php]

/usr/local/php/bin/phpize

3.配置扩展pdo

./configure –with-php-config=/usr/local/php/bin/php-config –enable-pdo=shared

4.编译安装pdo

make && make install

成功则出现

Installing shared extensions: /usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/

Installing header files: /usr/local/php//include/php/

Installing PDO headers: /usr/local/php//include/php/ext/pdo/

说明在/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/目录下生成了pdo.so文件

6.在php配置文件中加上

extension=”/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/pdo.so”

7.在PHP源码包中进入pdo_mysql

cd ext/pdo_mysql

8.执行/usr/local/php/bin/phpize

9.配置pdo_mysql[假设Mysql的安装目录为/usr/local/mysql]

./configure –with-php-config=/usr/local/php/bin/php-config –with-pdo-mysql=/usr/local/mysql

10.编译pdo_mysql 安装pdo_mysql

make && make install

成功则出现

Installing shared extensions: /usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/

说明的/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/目录下生成了pdo_mysql.so文件

12.在php配置文件中加上

extension=”/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so”

重启php和(nginx或Apache)即可!

错误解决:

make: *** [pdo_mysql.lo] Error 1

这是因为这是因为在编译时需要 MySQL 的头的文件。而它按默认搜索找不到头文件的位置,所以才出现这个问题。通过软连接把MySQL头文件对应到/usr/local/include/下就好

比如你的MySQL安装文件位于/usr/local/mysql,那么就执行以下命令:

# ln -s /usr/local/mysql/include/* /usr/local/include/

安装php扩展mysqli

1: cd 到mysqli文件目录下,执行 /usr/local/php/bin/phpize
2: ./configure –with-php-config=/usr/local/php/bin/php-config –with-mysqli=/usr/local/mysql/bin/mysql_config
3: make
4: make test
5: make install
6:修改php.ini
加入或者去掉注释 extension = “mysqli.so” (如果extension_dir 不对,此处需要写全路径)
然后重启web服务器