如何安裝apache+php+pthreads

如何安裝apache+php+pthreads

04 LTS 64 位元。

我真正想做的是sudo apt-get install libapache2-mod-php5用 編譯 PHP,--enable-maintainer-zts這樣我以後就可以用pecl install pthreads.可悲的是我明白這是不可能的。我知道最簡單的方法是重新編譯PHP以及apache支援和zts。不過,我真的很喜歡標準 Ubuntu PHP 套件的配置方式,而且我習慣了 CLI php.ini 配置、Apache php.ini 配置的路徑以及此 Ubuntu 套件定義的模組和檔案的其他路徑。所以我只想稍微改變一下包源並安裝它。

# Get the stuff necessary to build the package
sudo apt-get build-dep php5-common

# Get the package source
sudo apt-get source php5-common

此時,我取得的不是 php5-common 套件的源碼,而是整個 php5 套件的源碼。如果我sudo make && make install此時這樣做,是否意味著我正在安裝很多不必要的東西?

# Add configuration options
./configure --enable-maintainer-zts

這是否意味著我要附加一個配置選項?或者我正在生成一個全新的配置?

此時的替代方案有沒有辦法取得此套件定義的配置選項,以便我可以從 php.net 取得 php 來源並使用它進行編譯

$ ./configure  --prefix=package_prefix \ // Option 1 from package
--enable-embed \ // Option 2 from package
--with-regex=php \ // Option 3 from package

繼續主要思想...

解決方案1

# Compile (Not compiling)
sudo make && make install

此時我會用一切來建立 PHP 嗎?如果我這樣編譯,我將無法消除使用sudo apt-get purge php5?造成的混亂。

解決方案2

# ReCompile the package
dpkg-buildpackage -rfakeroot -uc -b

這也不能編譯。請修正我的步驟,以便我可以正確安裝所有內容。

答案1

您可以像這樣輕鬆獲得選項(您可以查看原始程式碼包,但這會減少工作量):

$ sudo apt-get install php5-dev
$ php-config --configure-options

--prefix=/usr --with-apxs2=/usr/bin/apxs2 --with-config-file-path=/etc/php5/apache2 
--with-config-file-scan-dir=/etc/php5/apache2/conf.d --build=x86_64-linux-gnu 
--host=x86_64-linux-gnu --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man 
--disable-debug --with-regex=php --disable-rpath --disable-static --with-pic 
--with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-sysvsem 
--enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype 
--with-db4 --without-gdbm --with-iconv --enable-exif --enable-ftp --with-gettext 
--enable-mbstring --with-pcre-regex=/usr --enable-shmop --enable-sockets 
--enable-wddx --with-libxml-dir=/usr --with-zlib --with-kerberos=/usr 
--with-openssl=/usr --enable-soap --enable-zip --with-mhash=yes --with-system-tzdata 
--with-mysql-sock=/var/run/mysqld/mysqld.sock --enable-dtrace --without-mm 
--with-curl=shared,/usr --with-enchant=shared,/usr --with-zlib-dir=/usr 
--with-gd=shared,/usr --enable-gd-native-ttf --with-gmp=shared,/usr 
--with-jpeg-dir=shared,/usr --with-xpm-dir=shared,/usr/X11R6 
--with-png-dir=shared,/usr --with-freetype-dir=shared,/usr 
--with-vpx-dir=shared,/usr --enable-intl=shared --without-t1lib 
--with-ldap=shared,/usr --with-ldap-sasl=/usr --with-mysql=shared,/usr 
--with-mysqli=shared,/usr/bin/mysql_config --with-pspell=shared,/usr 
--with-unixODBC=shared,/usr --with-recode=shared,/usr --with-xsl=shared,/usr 
--with-snmp=shared,/usr --with-sqlite3=shared,/usr --with-mssql=shared,/usr 
--with-tidy=shared,/usr --with-xmlrpc=shared --with-pgsql=shared,/usr

man php-config參閱更多選項。

相關內容