使用PDO MySQL编译PHP 5.1.6

时间:2022-09-19 14:33:51

I originally asked this question on ServerFault and haven't got any response and I figure it's programming related so, here goes...

我最初在ServerFault上问过这个问题并且没有得到任何回复,我认为这与编程有关,所以这里......


A while ago a large client of ours moved to a single hosting provider who spec'd out a software environment which would be consistent accross all the live servers.

不久之前,我们的一个大客户转移到一个托管服务提供商,他们指出了一个软件环境,这个环境在所有实时服务器上都是一致的。

Amongs other things this includes Apache 2.2.8 and PHP 5.1.6.

其他东西包括Apache 2.2.8和PHP 5.1.6。

We had an ubuntu 8.04 server for development and these versions of Apache and PHP are not the default installed. So I had to compile them from source. These versions have happily been running for over a year now.

我们有一个用于开发的ubuntu 8.04服务器,这些版本的Apache和PHP不是默认安装的。所以我不得不从源代码编译它们。这些版本现在已经运行了一年多。

We're starting a new site build and we want to use ZendFrameword which requires PDO_MySQL.

我们正在开始一个新的站点构建,我们想要使用需要PDO_MySQL的ZendFrameword。

I've tried recompiling with the following... (underscore shows continuation of line)

我尝试使用以下内容重新编译...(下划线显示行的延续)

./configure --with-apxs2=/usr/local/apache2/bin/apxs _
--with-config-file-path=/user/local/apache2/conf/php.ini _
--with-curl=/usr/lib/ --with-mysql=shared --with-mysqli=shared _
--with-zlib --with-gd --with-jpeg-dir=/usr/local/lib/ _
--with-freetype-dir=/usr/lib/ --enable-soap --enable-pdo=shared _
--with-pdo-mysql=shared --with-sqlite=shared
...
make
...
make install
...
libtool --finish /sources/php-5.1.6/libs

Which all works fine, and when I bring apache back up, it shows me the new ./configure in the phpinfo().

哪一切都运行正常,当我重新启动apache时,它会向我显示phpinfo()中的新./configure。

After doing this MySQL stops working, the MYSQL section disappears and msyql stops working.

执行此操作后,MySQL停止工作,MYSQL部分消失,msyql停止工作。

The make, make install, libtool... puts the *.so files in

make,make install,libtool ...将* .so文件放入

/usr/local/lib/php/extensions/no-debug-non-zts-20050922

The configure I have used previously which enabled MySQL but not PDO is

我之前使用的配置启用了MySQL而不是PDO

./configure --with-apxs2=/usr/local/apache2/bin/apxs _
--with-config-file-path=/user/local/apache2/conf/php.ini _
--with-curl=/usr/lib/ --with-mysql --with-mysqli _
--with-zlib --with-gd --with-jpeg-dir=/usr/local/lib/ _
--with-freetype-dir=/usr/lib/ --enable-soap

I'm not a massive *nix person, can anyone tell me where I'm going wrong.

我不是一个大规模的* nix人,谁能告诉我哪里出错了。

Thanks

2 个解决方案

#1


I am not sure it will really help, but what if you remove every instance of "=shared" in your configure line ?

我不确定它会有什么帮助,但是如果你删除配置行中的每个“= shared”实例怎么办?

For example, here is an configure command I've used some time ago *(as given by phpinfo)* :

例如,这是我前段时间使用的配置命令*(由phpinfo给出)*:

$ /usr/local/php-5.1.6/bin/php -i | grep 'configure'
Configure Command =>  './configure' '--prefix=/usr/local/php-5.1.6' '--with-config-file-path=/etc/php-5.1.6' 
  '--with-apxs2=/usr/bin/apxs2' '--disable-ipv6' '--with-openssl' '--with-zlib' '--enable-bcmath' 
  '--with-bz2' '--with-curl' '--enable-exif' '--enable-ftp' '--with-gd' '--with-ttf' 
  '--enable-gd-native-ttf' '--with-imap-ssl' '--with-ldap' '--enable-mbstring' '--with-mcrypt' 
  '--with-mhash' '--with-mysql' '--with-mysqli' '--enable-pcntl' '--with-pdo-mysql' '--with-pdo-sqlite' 
  '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sqlite-utf8' '--with-xmlrpc' 
  '--with-xsl' '--with-pear'

(newlines added for the sake of readability)

(为了便于阅读而添加了换行符)

Does it help ?

有帮助吗?

#2


No need to recompile whole PHP. Just compile PDO_MYSQL module alone. Use pecl to install it:

无需重新编译整个PHP。只需单独编译PDO_MYSQL模块。使用pecl来安装它:

pecl install PDO_MYSQL

For that you will need phpize installed. On Debian machines it is provided by package called php5-dev. Afterwards just add it to your php.ini and restart Apache.

为此你需要安装phpize。在Debian机器上,它由名为php5-dev的包提供。然后将它添加到您的php.ini并重新启动Apache。

If you are on Debian/Ubuntu system PDO_MYSQL is provided in package called php5-mysql

如果你在Debian / Ubuntu系统上,PDO_MYSQL是在名为php5-mysql的包中提供的

#1


I am not sure it will really help, but what if you remove every instance of "=shared" in your configure line ?

我不确定它会有什么帮助,但是如果你删除配置行中的每个“= shared”实例怎么办?

For example, here is an configure command I've used some time ago *(as given by phpinfo)* :

例如,这是我前段时间使用的配置命令*(由phpinfo给出)*:

$ /usr/local/php-5.1.6/bin/php -i | grep 'configure'
Configure Command =>  './configure' '--prefix=/usr/local/php-5.1.6' '--with-config-file-path=/etc/php-5.1.6' 
  '--with-apxs2=/usr/bin/apxs2' '--disable-ipv6' '--with-openssl' '--with-zlib' '--enable-bcmath' 
  '--with-bz2' '--with-curl' '--enable-exif' '--enable-ftp' '--with-gd' '--with-ttf' 
  '--enable-gd-native-ttf' '--with-imap-ssl' '--with-ldap' '--enable-mbstring' '--with-mcrypt' 
  '--with-mhash' '--with-mysql' '--with-mysqli' '--enable-pcntl' '--with-pdo-mysql' '--with-pdo-sqlite' 
  '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sqlite-utf8' '--with-xmlrpc' 
  '--with-xsl' '--with-pear'

(newlines added for the sake of readability)

(为了便于阅读而添加了换行符)

Does it help ?

有帮助吗?

#2


No need to recompile whole PHP. Just compile PDO_MYSQL module alone. Use pecl to install it:

无需重新编译整个PHP。只需单独编译PDO_MYSQL模块。使用pecl来安装它:

pecl install PDO_MYSQL

For that you will need phpize installed. On Debian machines it is provided by package called php5-dev. Afterwards just add it to your php.ini and restart Apache.

为此你需要安装phpize。在Debian机器上,它由名为php5-dev的包提供。然后将它添加到您的php.ini并重新启动Apache。

If you are on Debian/Ubuntu system PDO_MYSQL is provided in package called php5-mysql

如果你在Debian / Ubuntu系统上,PDO_MYSQL是在名为php5-mysql的包中提供的