2011-03-08 26 views
0

我注意到PHP使我在開發盒上使用沒有啓用xmlreader和xmlwriter擴展。我知道我需要重新編譯PHP來啓用這些擴展(或者更準確地說,可以刪除禁用,因爲它們默認啓用?),但我遇到了一個問題,需要從我需要運行./configure和make命令。使用xmlreader重新編譯PHP,啓用xmlwriter

這裏是我的配置命令從phpinfo()函數輸出:

'./configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' \ 
'--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' \ 
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' \ 
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' \ 
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' \ 
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' \ 
'--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' \ 
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' \ 
'--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' \ 
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' \ 
'--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' \ 
'--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' \ 
'--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' \ 
'--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' \ 
'--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' \ 
'--enable-calendar' '--without-mime-magic' '--without-sqlite' \ 
'--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' \ 
'--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--disable-dom' \ 
'--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' \ 
'--disable-xmlwriter' '--without-sqlite3' '--disable-phar' '--disable-fileinfo' \ 
'--disable-json' '--without-pspell' '--disable-wddx' '--without-curl' \ 
'--disable-posix' '--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem' 

注意,它與 - 禁用的XMLReader和 - 禁用的XmlWriter編譯。根據http://www.php.net/manual/en/xmlwriter.installation.php的文檔,我發現默認情況下啓用了此擴展。我將如何「撤消」這個擴展禁用?

我的目標是能夠使用PHPExcel類集(http://phpexcel.codeplex.com/),但是因爲其中一個類試圖擴展XMLWriter類而出現致命錯誤。

+0

我只是使用./configure行,然後make clean,make,make test並進行安裝以重建RH ES4上的PHP;但我確實在使用rpm -e – 2011-03-08 15:06:32

回答

2

如果您使用的是有二進制包(如openSUSE的)的發行版之一 - 你mihgt只想安裝PHP-XmlWriter的包作爲一個擴展。

另一種選擇 - 只需要獲取版本的源代碼,然後使用phpize編譯xmlwriter作爲模塊(如果需要更多幫助,請告訴我)。

如果這不起作用 - 您將需要獲取源代碼,並從頭開始編譯所有內容。在這種情況下,配置將從您提取源的文件夾運行。

要記住的其他事項 - 現在已經安裝的任何擴展 - 您需要編譯它們,或者使用獲得的源代碼重新編譯(除非PHP版本匹配 - 那麼您可以使用已安裝的源代碼)。

最後,發行版通常會附帶一些php的二進制文件(如CGI,apache模塊,cli)。您需要確保在配置命令中啓用了此功能(或者您需要的任何部分)。

+0

如果我使用你的第一個建議(作爲擴展安裝),我會爲xmlwriter抓取.so嗎? – jonwayne 2011-03-08 15:24:20

+1

第一個 - 您需要安裝發行版隨附的RPM或DEB軟件包。 「yum安裝php-xmlwriter」或「apt-get install php-xmlwriter」。或者下載適當的軟件包並安裝。 – Sergey 2011-03-08 16:28:50

+0

我能夠阻止http://yum.chrislea.com/centos/5/i386/上的rpm並且工作正常。謝謝你的幫助! – jonwayne 2011-03-08 20:57:24

1

只需在解壓縮源的目錄(例如/home/user/php-5.3.5)中運行configure命令,並且不要包含這兩個選項。即:

./configure -prefix=/usr ... <everything but --disable-xmlreader and --disable-xmlwriter> 
+0

的新服務器版本上刪除了所有Redhat rpms。也許我正在以這種錯誤的方式進行討論,但我嘗試了一個'locate php-5.3.2',但沒有看到源文件。但是,我發現/var/cache/yum/remi/packages/php-5.3.2-2.el5.remi.i386.rpm。我應該只下載/提取最新版本,並在其上運行configure命令? – jonwayne 2011-03-08 15:09:50

+0

@jonwayne - 默認情況下你不會有源文件。你需要分開拿到它們。 – Sergey 2011-03-08 15:12:45

+0

這就是我會推薦的,是的。 – 2011-03-08 15:13:12