全球主机交流论坛

标题: 求助编译安装php代码说明! [打印本页]

作者: 每次醒来    时间: 2013-8-25 23:15
标题: 求助编译安装php代码说明!
本帖最后由 每次醒来 于 2013-8-26 03:36 编辑

CentOS  6.4系统
  1. mysql 直接  yum install mysql mysql-server
复制代码
  1. nginx  自己编译安装 ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-cc-opt='-O3'
复制代码
程序不支持php5.4  不会编译 高手给了我以下 2句代码 求详细说明 求飘红 路径啥的说明

第一句代码如下
if cat /etc/redhat-release | grep 'CentOS release 5';then rpm -ivh http://download4.fedora.redhat.com/pub/epel/5/`uname -i`/epel-release-5-4.noarch.rpm;fi
if cat /etc/redhat-release | grep 'CentOS release 6';then rpm -ivh http://download4.fedora.redhat.com/pub/epel/6/`uname -i`/epel-release-6-8.noarch.rpm; fi
yum -y --skip-broken install gcc  gcc-c++ libtool-libs libtool autoconf subversion zip unzip  wget crontabs iptables file bison patch mlocate flex diffutils automake imake make cmake kernel-devel cpp  vim-minimal \
libevent-devel freetype-devel libxml2-devel gd gd-devel libjpeg-devel libpng-devel ncurses-devel zlib-devel  \
curl-devel readline-devel openssl-devel  glibc-devel  glib2-devel bzip2-devel e2fsprogs-devel libidn-devel  gettext-devel expat-devel libcap-devel  libtool-ltdl-devel pam-devel \
libxslt-devel libc-client-devel freetds-devel unixODBC-devel libtidy-devel libXpm-devel krb5-devel libicu-devel icu \
pcre-devel  libmcrypt-devel mhash-devel
if [ `uname -i` == x86_64 ]; then ln -s /usr/lib64/{libpcre*,libjpeg.so,libpng.so,libXpm.so,libc-client.so,libkrb5.so,libexpat.so,libevent.so} /usr/lib/;fi



第二句代码如下
wget -c http://us.php.net/get/php-5.3.25.tar.gz/from/us2.php.net/mirror
tar xzf php-5.3.25.tar.gz
cd php-5.3.25
wget -c http://pecl.php.net/get/memcache-3.0.6.tgz
tar zxf memcache-3.0.6.tgz
mv memcache-3.0.6 ext/memcache
rm -f configure
./buildconf --force
./configure --prefix=/opt/php53 --with-config-file-path=/opt/php53/etc --with-config-file-scan-dir=/opt/php53/etc/php.d \
--without-pear --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml \
--enable-magic-quotes --enable-mbstring --enable-soap --enable-sockets --enable-wddx --enable-zip --with-curl \
--with-freetype-dir=/usr --with-gd --with-gettext --with-imap --with-imap-ssl --with-png-dir  --with-jpeg-dir=/usr \
--with-libexpat-dir=/usr --with-libxml-dir=/usr --with-mcrypt --with-mhash  \
--with-pdo-mysql  --with-mysql=/usr --with-mysql-sock=/tmp/mysql.sock --with-mysqli=/usr/bin/mysql_config \
--with-openssl --with-pcre-regex=/usr/local --with-png-dir=/usr --with-tidy --with-unixODBC=/usr --with-xmlrpc \
--with-xpm-dir=/usr --with-zlib --with-zlib-dir=/usr --with-kerberos --enable-intl=shared \
--enable-memcache --with-zlib-dir;
make -j12
make install













第一句执行完毕会出现

[root@123 ]#if [ `uname -i` == x86_64 ]; then ln -s /usr/lib64/{libpcre*,libjpeg.so,libpng.so,libXpm.so,libc-client.so,libkrb5.so,libexpat.so,libevent.so} /usr/lib/;fi



执行第二句会出现这样的...... 那里错了
./buildconf --force
Forcing buildconf
buildconf: checking installation...
buildconf: You need autoconf 2.59 or lower to build this version of PHP.
           You are currently trying to use 2.63
           Most distros have separate autoconf 2.13 or 2.59 packages.
           On Debian/Ubuntu both autoconf2.13 and autoconf2.59 packages exist.
           Install autoconf2.13 and set the PHP_AUTOCONF env var to
           autoconf2.13 and try again.
make: *** [buildmk.stamp] Error 1
[root@123 php-5.3.25]# ./configure --prefix=/opt/php53 --with-config-file-path=/opt/php53/etc --with-config-file-scan-dir=/opt/php53/etc/php.d \
> --without-pear --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml \
> --enable-magic-quotes --enable-mbstring --enable-soap --enable-sockets --enable-wddx --enable-zip --with-curl \
> --with-freetype-dir=/usr --with-gd --with-gettext --with-imap --with-imap-ssl --with-png-dir  --with-jpeg-dir=/usr \
> --with-libexpat-dir=/usr --with-libxml-dir=/usr --with-mcrypt --with-mhash  \
> --with-pdo-mysql  --with-mysql=/usr --with-mysql-sock=/tmp/mysql.sock --with-mysqli=/usr/bin/mysql_config \
> --with-openssl --with-pcre-regex=/usr/local --with-png-dir=/usr --with-tidy --with-unixODBC=/usr --with-xmlrpc \
> --with-xpm-dir=/usr --with-zlib --with-zlib-dir=/usr --with-kerberos --enable-intl=shared \
> --enable-memcache --with-zlib-dir;
-bash: ./configure: No such file or directory
[root@123 php-5.3.25]# make -j12
make: *** No targets specified and no makefile found.  Stop.
作者: ★Extreme★    时间: 2013-8-25 23:15
每次醒来 发表于 2013-8-25 23:48
fastcgi_pass 127.0.0.1:9000;

这个可以吗?   php停止 启动命令是啥?

可以的,执行/opt/php53/sbin/php-fpm可以启动
作者: ★Extreme★    时间: 2013-8-25 23:36
自带的,./configure --help|tee ./configurehelp.txt&&vim configure.txt
作者: ★Extreme★    时间: 2013-8-25 23:39
启动nginx的话,根据你的编译参数,执行 /usr/local/nginx/sbin/nginx,停止就执行pkill nginx
作者: 每次醒来    时间: 2013-8-25 23:41
★Extreme★ 发表于 2013-8-25 23:39
启动nginx的话,根据你的编译参数,执行 /usr/local/nginx/sbin/nginx,停止就执行pkill nginx ...

nginx的我有脚本 , 就是不知道编译php这2句话里面啥路径 搞不明白还有怎么和nginx 关联?
作者: ★Extreme★    时间: 2013-8-25 23:42
按照你编译PHP的参数,fpm应该是listen 127.0.0.1:9000
作者: ★Extreme★    时间: 2013-8-25 23:46
每次醒来 发表于 2013-8-25 23:41
nginx的我有脚本 , 就是不知道编译php这2句话里面啥路径 搞不明白还有怎么和nginx 关联? ...


按照你的参数,PHP在/opt/php53,监听的是127.0.0.1:9000,nginx那就用fastcgi_pass unix:127.0.0.1:9000连接PHP
作者: 每次醒来    时间: 2013-8-25 23:48
★Extreme★ 发表于 2013-8-25 23:46
按照你的参数,PHP在/opt/php53,监听的是127.0.0.1:9000,nginx那就用fastcgi_pass unix:127.0.0.1:9000 ...

fastcgi_pass 127.0.0.1:9000;

这个可以吗?   php停止 启动命令是啥?
作者: ★Extreme★    时间: 2013-8-25 23:54
好困,我睡觉,你看nginx.conf的注释,php的location那有说明。
作者: 每次醒来    时间: 2013-8-26 00:23
本帖最后由 每次醒来 于 2013-8-26 02:23 编辑
★Extreme★ 发表于 2013-8-25 23:54
好困,我睡觉,你看nginx.conf的注释,php的location那有说明。



第一句执行完毕会出现

[root@123 ]#if [ `uname -i` == x86_64 ]; then ln -s /usr/lib64/{libpcre*,libjpeg.so,libpng.so,libXpm.so,libc-client.so,libkrb5.so,libexpat.so,libevent.so} /usr/lib/;fi



执行第二句会出现这样的...... 那里错了
./buildconf --force
Forcing buildconf
buildconf: checking installation...
buildconf: You need autoconf 2.59 or lower to build this version of PHP.
           You are currently trying to use 2.63
           Most distros have separate autoconf 2.13 or 2.59 packages.
           On Debian/Ubuntu both autoconf2.13 and autoconf2.59 packages exist.
           Install autoconf2.13 and set the PHP_AUTOCONF env var to
           autoconf2.13 and try again.
make: *** [buildmk.stamp] Error 1
[root@123 php-5.3.25]# ./configure --prefix=/opt/php53 --with-config-file-path=/opt/php53/etc --with-config-file-scan-dir=/opt/php53/etc/php.d \
> --without-pear --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml \
> --enable-magic-quotes --enable-mbstring --enable-soap --enable-sockets --enable-wddx --enable-zip --with-curl \
> --with-freetype-dir=/usr --with-gd --with-gettext --with-imap --with-imap-ssl --with-png-dir  --with-jpeg-dir=/usr \
> --with-libexpat-dir=/usr --with-libxml-dir=/usr --with-mcrypt --with-mhash  \
> --with-pdo-mysql  --with-mysql=/usr --with-mysql-sock=/tmp/mysql.sock --with-mysqli=/usr/bin/mysql_config \
> --with-openssl --with-pcre-regex=/usr/local --with-png-dir=/usr --with-tidy --with-unixODBC=/usr --with-xmlrpc \
> --with-xpm-dir=/usr --with-zlib --with-zlib-dir=/usr --with-kerberos --enable-intl=shared \
> --enable-memcache --with-zlib-dir;
-bash: ./configure: No such file or directory
[root@123 php-5.3.25]# make -j12
make: *** No targets specified and no makefile found.  Stop.
作者: ★Extreme★    时间: 2013-8-26 06:51
本帖最后由 ★Extreme★ 于 2013-8-26 07:01 编辑
每次醒来 发表于 2013-8-26 00:23
第一句执行完毕会出现

[root@123 ]#if [ `uname -i` == x86_64 ]; then ln -s /usr/lib64/{libpcre*,li ...


没有安装make和autoconf,执行:
  1. yum install autoconf make -y
复制代码
而且你说的第一句:
  1. if [ `uname -i` == x86_64 ]; then ln -s /usr/lib64/{libpcre*,libjpeg.so,libpng.so,libXpm.so,libc-client.so,libkrb5.so,libexpat.so,libevent.so} /usr/lib/;fi
复制代码
貌似有点问题,fi和/usr/lib怎么用“;”分开了?
按照我写Shell Scripts的习惯,我觉得应该是

  1. bit=$(uname -i)
  2. if [ “$bit” = "x86_64" ];then
  3. ln -s /usr/lib64/{libpcre*,libjpeg.so,libpng.so,libXpm.so,libc-client.so,libkrb5.so,libexpat.so,libevent.so} /usr/lib/
  4. fi
复制代码
如果你的系统是64位的,就直接执行:
  1. ln -s /usr/lib64/{libpcre*,libjpeg.so,libpng.so,libXpm.so,libc-client.so,libkrb5.so,libexpat.so,libevent.so} /usr/lib/
复制代码
否则就忽略掉吧。
作者: ★Extreme★    时间: 2013-8-26 07:08
这是Nginx用PHP-FPM的配置:
  1.         location ~ \.php$ {
  2.                 fastcgi_split_path_info ^(.+\.php)(/.+)$;
  3.         #      fastcgi_pass 127.0.0.1:9000; #PHP-FPM默认是listen 127.0.0.1:9000的,解除注释这个就好
  4.         #      fastcgi_pass unix:xxxxxxx.sock; 如果改成listen xxxxx.sock就用这个
  5.                 fastcgi_param   SCRIPT_FILENAME         $request_filename;
  6.                 fastcgi_index index.php;
  7.                 include fastcgi_params;
复制代码
我建议把
  1. fastcgi_param   SCRIPT_FILENAME         $request_filename;
复制代码
这句加到fastcgi_params这个文件里面吧。




欢迎光临 全球主机交流论坛 (https://sunk.eu.org/) Powered by Discuz! X3.4