當前位置:首頁 » 編程語言 » phpwithttf

phpwithttf

發布時間: 2023-01-05 14:46:55

① 求助,linux系統安裝php,報錯!

請用 ./configure 還有就是你那一堆換行連接符 有問題 ,./configure 是autoconf 生成的一個對應不同的環境進行配置的一個shell 文件,如果你還是報錯,那麼檢查你後面with的那一堆php擴展的依賴,一般你with 那麼多是安裝不過的 。

② linux系統如何讓php使用GD庫函數

linux下為php添加GD庫的步驟如下:

一、下載

gd-2.0.33.tar.gz http://www.boutell.com/gd/
jpegsrc.v6b.tar.gz http://www.ijg.org/
libpng-1.2.7.tar.tar http://sourceforge.net/projects/libpng/
zlib-1.2.2.tar.gz http://sourceforge.net/projects/zlib/
freetype-2.1.9.tar.gz http://sourceforge.net/projects/freetype/
php-4.3.9.tar.gz http://www.php.net

二、安裝

1.安裝zlib

tar zxvf zlib-1.2.2.tar.gz
cd zlib-1.2.2
./configure
make
make install

2.安裝libpng

tar zxvf libpng-1.2.7.tar.tar
cd libpng-1.2.7
cd scripts/
mv makefile.linux ../makefile
cd ..
make
make install
注意,這里的makefile不是用./configure生成,而是直接從scripts/里拷一個

3.安裝freetype

tar zxvf freetype-2.1.9.tar.gz
cd freetype-2.1.9
./configure
make
make install

4.安裝Jpeg

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --enable-shared
make
make test
make install
注意,這里configure一定要帶--enable-shared參數,不然,不會生成共享庫

5.安裝GD

tar zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --with-png --with-freetype --with-jpeg
make install

6.重新編譯PHP

tar zxvf php-4.3.9.tar.gz
cd php-4.3.9
./configure (以前的參數) --with-gd --enable-gd-native-ttf --with-zlib --with-png --with-jpeg --with-freetype --enable-sockets
make
make install

<?php
phpinfo();
?>

Ok.....

③ phpinfo中沒有freetype但是我是裝了freetype。

什麼操作系統?麻煩把你的運行環境寫出來,這樣才能幫你解決問題。 ./--with-freetype-dir=/usr/local/freetype

④ 如何在linux下安裝多個不同版本的PHP

Linux (測試環境 Ubuntu 12.04 Server X86_64)
1. 安裝編譯工具及所需類庫
$ sudo apt-get install build-essential gcc g++ autoconf libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev bzip2 libbz2-dev openssl libssl-dev curl libcurl4-openssl-dev libpcre3 libpcre3-dev libevent-1.4-2 libevent-dev libmcrypt4 libmcrypt-dev mcrypt libltdl-dev libldap2-dev libsasl2-dev libmhash-dev libc-client2007e libc-client2007e-dev
2. 安裝Mysql
$ sudo apt-get install mysql-server libmysqlclient-dev
3. 安裝PHP
Linux下多版本PHP共存需要自己手工編譯安裝。
下載PHP源文件到/opt/src目錄
$ mkdir /opt/src
$ cd /opt/src
$ wget http://museum.php.net/php5/php-5.2.17.tar.bz2 -O php-5.2.17.tar.bz2
$ wget http://cn2.php.net/get/php-5.3.28.tar.bz2/from/this/mirror -O php-5.3.28.tar.bz2
$ wget http://cn2.php.net/get/php-5.4.29.tar.bz2/from/this/mirror -O php-5.4.29.tar.bz2
$ wget http://cn2.php.net/get/php-5.5.14.tar.bz2/from/this/mirror -O php-5.5.14.tar.bz2
創建PHP各版本安裝目錄
$ mkdir -p /opt/php/{5217,5328,5429,5514}
安裝PHP 5.2.17
$ cd /opt/src
$ tar -xvjf php-5.2.17.tar.bz2
$ cd php-5.2.17
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/libjpeg.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/libpng.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libkrb5.so /usr/lib/libkrb5.so
$ wget -O debian_patches_disable_SSLv2_for_openssl_1_0_0.patch 「https://bugs.php.net/patch-display.php?bug_id=54736&patch=debian_patches...」
$ patch -p1 < debian_patches_disable_SSLv2_for_openssl_1_0_0.patch
$ ./configure --prefix=/opt/php/5217 --with-config-file-scan-dir=/opt/php/5217/etc/php.d --with-mysql --with-pdo-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-ftp --disable-debug --disable-ipv6 --disable-short-tags --enable-calendar --with-mime-magic --with-imap --with-imap-ssl --with-kerberos
$ make
$ sudo make install
$ cp php.ini-recommended /opt/php/5217/lib/php.ini
安裝PHP 5.3.28
$ cd /opt/src
$ tar -xvjf php-5.3.28.tar.bz2
$ cd php-5.3.28
$ ./configure --prefix=/opt/php/5328 --with-config-file-scan-dir=/opt/php/5328/etc/php.d --with-mysql --with-pdo-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-ftp --disable-debug --disable-ipv6 --disable-short-tags --enable-calendar --with-imap --with-imap-ssl --with-kerberos
$ make
$ sudo make install
$ cp php.ini-development /opt/php/5328/lib/php.ini
安裝PHP 5.4.29
$ cd /opt/src
$ tar -xvjf php-5.4.29.tar.bz2
$ cd php-5.4.29
$ ./configure --prefix=/opt/php/5429 --with-config-file-scan-dir=/opt/php/5429/etc/php.d --with-mysql --with-pdo-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-ftp --disable-debug --disable-ipv6 --disable-short-tags --enable-calendar --with-imap --with-imap-ssl --with-kerberos
$ make
$ sudo make install
$ cp php.ini-development /opt/php/5429/lib/php.ini
安裝PHP 5.5.14
$ cd /opt/src
$ tar -xvjf php-5.5.14.tar.bz2
$ cd php-5.5.14
$ ./configure --prefix=/opt/php/5514 --with-config-file-scan-dir=/opt/php/5514/etc/php.d --with-mysql --with-pdo-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-ftp --disable-debug --disable-ipv6 --disable-short-tags --enable-calendar --with-imap --with-imap-ssl --with-kerberos
$ make
$ sudo make install
$ cp php.ini-development /opt/php/5514/lib/php.ini
4. 安裝Apache
$ sudo apt-get install apache2
啟用相應模塊
$ a2enmod headers
$ a2enmod expires
$ a2enmod actions
$ a2enmod rewrite
5. 配置Apache
$ sudo vi /etc/apache2/httpd.conf
追加如下腳本映射和虛擬主機配置,原理同Windows的配置說明。
ServerName localhost
AddType application/x-httpd-php .php
ScriptAlias /php-5217/ "/opt/php/5217/bin/"
ScriptAlias /php-5328/ "/opt/php/5328/bin/"
ScriptAlias /php-5429/ "/opt/php/5429/bin/"
ScriptAlias /php-5514/ "/opt/php/5514/bin/"
<Directory /var/www/sites>
Options Indexes FollowSymLinks Includes ExecCGI
DirectoryIndex index.php index.html
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/sites/5217>
Action application/x-httpd-php "/php-5217/php-cgi"
</Directory>
<Directory /var/www/sites/5328>
Action application/x-httpd-php "/php-5328/php-cgi"
</Directory>
<Directory /var/www/sites/5429>
Action application/x-httpd-php "/php-5429/php-cgi"
</Directory>
<Directory /var/www/sites/5514>
Action application/x-httpd-php "/php-5514/php-cgi"
</Directory>
# Virtualhosts
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/sites/5217/test.local"
ServerName php5217.local
ErrorLog "/var/log/apache2/php5217.local-error.log"
CustomLog "/var/log/apache2/php5217.local-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/sites/5328/test.local"
ServerName php5328.local
ErrorLog "/var/log/apache2/php5328.local-error.log"
CustomLog "/var/log/apache2/php5328.local-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/sites/5429/test.local"
ServerName php5429.local
ErrorLog "/var/log/apache2/php5429.local-error.log"
CustomLog "/var/log/apache2/php5429.local-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/sites/5514/test.local"
ServerName php5514.local
ErrorLog "/var/log/apache2/php5514.local-error.log"
CustomLog "/var/log/apache2/php5514.local-access.log" common
</VirtualHost>
保存配置後,創建各站點的DocumentRoot目錄,再往每個目錄放置一個phpinfo的測試文件,完成後重啟Apache伺服器並在本地hosts文件加入域名解析,現在就可以訪問各站點來測試多版本PHP共存了。

好了,基本的多版本PHP共存解決方案已經完成,如果還需要添加其他的PHP類庫支持,後續自己再調用對應php目錄下的pecl, php_config等腳本編譯安裝就可以了。

⑤ PHP GD庫錯誤

提示錯誤大意是:JPgGragh提示你:你安裝php時,沒有同時配置和編譯你的GD庫,你需要重新編輯你的PHP,以獲得對GD庫的支持
同時你函數imagetypes()和imagecreatefromstring()不存在,這有可能是你php.ini沒有打開GD庫的支持

同時附上編譯PHP(with gd)時需加的參數

PHP4-Server:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-config-file-path=/etc --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-xml --enable-mbstring

PHP4-Max:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --mandir=/usr/share/man --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php/etc --with-openssl=/usr/local/openssl-0.9.7e --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-bz2 --with-inifile --with-hyperwave --enable-xml --enable-track-vars --enable-dba --enable-dbase --enable-filepro --enable-ftp --enable-versioning --enable-memory-limit --enable-calendar --enable-session --enable-sockets --enable-sysmsg --enable-sysvsem --enable-sysvshm --enable-tokenizer --enable-overload --enable-ctype --enable-sigchild --enable-magic-quotes --enable-roxen-zts --enable-fastcgi --enable-dbx --enable-dio --enable-shmop --enable-mbstring

PHP5-Server:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib-dir --with-bz2 --with-tiff-dir --with-libxml-dir --with-gd --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf --enable-mbstring --with-mysql=/usr/lib/mysql --with-config-file-path=/etc --disable-ipv6 --enable-gd-native-ttf

PHP5-Standard:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --mandir=/usr/share/man --with-openssl=/usr/local/openssl-0.9.7e --with-zlib --with-bz2 --with-tiff-dir --with-libxml-dir --enable-dio --enable-ftp --with-gd --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-bz2-dir --with-ttf --enable-mbstring --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php/etc --disable-ipv6 --enable-gd-native-ttf

PHP5-Max:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --mandir=/usr/share/man --with-openssl=/usr/local/openssl-0.9.7e --with-zlib --with-bz2 --with-tiff-dir --with-libxml-dir --enable-dio --enable-ftp --with-gd --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-bz2-dir --with-ttf --with-inifile --enable-dba --enable-dbase --enable-filepro --enable-versioning --enable-memory-limit --enable-calendar --enable-sockets --enable-sysvsem --enable-sigchild --enable-magic-quotes --enable-roxen-zts --enable-fastcgi --enable-dbx --enable-shmop --enable-mbstring --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php/etc --disable-ipv6 --enable-gd-native-ttf

⑥ 編譯PHP提示出錯找不到libc-client.無法編譯PHP怎麼辦

I. 安裝devel庫
yum install pam-devel libc-client libc-client-devel -y
如果使用了yum安裝了libc-client,那麼在以後編譯參數--with-imap=/usr/local/php-imap中的路徑應該刪除,即--with-imap。
如果這樣還不能解決,那麼就需要手動編譯imap2007f了!
II. 手動編譯imap2007f
腳本取自 forum.directadmin.com/showthread.php?t=45434
在/usr/src目錄下運行以下腳本,將會在/usr/local/php-imap目錄下生成imap需要的庫
#!/bin/sh
# Script for PHP-IMAP installation. 0.1b
# Written by Martynas Bendorius (smtalk)
CWD=`pwd`
OS=`uname`
#Is it a 64-bit OS?
B64=0
B64COUNT=`uname -m | grep -c 64`
if [ "$B64COUNT" -eq 1 ]; then
B64=1
LD_LIBRARY_PATH=/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
fi
if [ ! -e /usr/include/krb5.h ] && [ -e /etc/redhat-release ]; then
echo "Installing krb5-devel"
yum -y install krb5-devel
fi
VERSION=2007f
PROTOCOL=ftp
URL="${PROTOCOL}://ftp.cac.washington.e/imap/imap-${VERSION}.tar.Z"
FILENAME=imap-${VERSION}
TARBALL=${FILENAME}.tar.Z
echo "Downloading ${TARBALL}..."
wget -O ${TARBALL} ${URL}
tar xzf ${TARBALL}
cd ${FILENAME}
echo "Installing ${FILENAME}..."
if [ ${OS} = "FreeBSD" ]; then
if [ ${B64} -eq 0 ]; then
make bsf
else
make bsf EXTRACFLAGS=-fPIC
fi
else
perl -pi -e 's#SSLDIR=/usr/local/ssl#SSLDIR=/etc/pki/tls#' src/osdep/unix/Makefile
perl -pi -e 's#SSLINCLUDE=\$\(SSLDIR\)/include#SSLINCLUDE=/usr/include/openssl#' src/osdep/unix/Makefile
perl -pi -e 's#SSLLIB=\$\(SSLDIR\)/lib#SSLLIB=/usr/lib/openssl#' src/osdep/unix/Makefile
if [ ${B64} -eq 0 ]; then
make slx
else
make slx EXTRACFLAGS=-fPIC
fi
fi
echo "Copying files to /usr/local/php-imap"
mkdir -p /usr/local/php-imap/include
mkdir -p /usr/local/php-imap/lib
chmod -R 077 /usr/local/php-imap
cp -f c-client/*.h /usr/local/php-imap/include/
cp -f c-client/*.c /usr/local/php-imap/lib/
cp -f c-client/c-client.a /usr/local/php-imap/lib/libc-client.a
cd ..
rm -rf ${FILENAME}
if [ -d /usr/lib/x86_64-linux-gnu ] && [ ! -d /usr/kerberos/lib ]; then
mkdir -p /usr/kerberos
ln -s /usr/lib/x86_64-linux-gnu /usr/kerberos/lib
fi

exit 0;
III. 開始編譯
下面是編譯PHP的參數,如果出現問題,請參考編譯PHP5.6 和 PHP編譯錯誤的解決辦法。
./configure --prefix=/usr/local/php --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --enable-ftp --with-imap=/usr/local/php-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --disable-fileinfo
IV. 其他問題
在本次編譯中,老高又遇到了幾個怪事
set --enable-opcache=no
configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no
這個問題還是庫文件的鏈接問題
解決:
echo /usr/local/lib > /etc/ld.so.conf.d/local.conf
ldconfig -v
讓編譯的PHP支持memcache

⑦ [100分]PHP 編譯時出現WARNING: unrecognized options

你那裡怎麼要加上逗號?

--with-ttf 後面指定一下字型檔路徑試試
--with-ttf=/usr/local/freetype/

⑧ linux下配置apache同時支持 php cgi

安裝LINUX時如果安裝了PERL 那麼裝上LINUX立刻可以執行CGI 只要在HTTPD.CONF裡面允許了CGI 一般默認安裝都可以

PHP你到php.net下載PHP 編譯安裝後 修改HTTPD.CONF 添加相關擴展就可以了

------------------------------------------------------------
說得比較不詳細 轉一個帖
------------------------------------------------------------
Linux+Apache+Mysql+PHP典型配置
版權聲明:可以任意轉載,轉載時請務必以超鏈接形式標明文章原始出處和作者信息及本聲明

http://www.5ilinux.com/lamp01.html

關鍵字:apache+mysql+php apache mysql php 配置 lamp 伺服器 web

Linux+Apache+Mysql+PHP典型配置

調試環境:Redhat9.0 Apache1.3.29 Mysql3.23.58 PHP4.3.4

Linux系統的安裝我就不講了,這是基本功,其實這篇文章在類似Redhat的其他linux也應該通用,大家只要掌握我提供的方法就行。記得安裝Redhat9。0的時候不要安裝系統默認的apache,mysql和php以及相關的軟體。已經安裝的請用rpm -e * 刪除已經安裝的包。

1.安裝Mysql3.23.58

其實老實說直接安裝Mysql官方網站提供的rpm包也是一個比較可行的辦法,他的官方網站的rpm包的提供基本跟tar包發行是同步的,這點我比較喜歡,至少安裝rpm包的在後面的調試中不會出現mysql庫文件找不到的情況。但這里還是有必要講一下自定義安裝的步驟,畢竟網友自定義安裝的還說挺多的。

軟體獲取:http://www.mysql.com/downloads/index.html

安裝步驟:

tar zxvf mysql-3.23.58.tar.gz
cd mysql-3.23.58

./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql

make

make install

#prefix=/usr/local/mysql mysql安裝的目標目錄

#sysconfdir=/etc my.ini配置文件的路徑

#localstatedir=/var/lib/mysql 資料庫存放的路徑

安裝完以後要初始化資料庫,當然你是升級的話不用做這步;

/usr/local/mysql/bin/mysql_install_db

如果系統沒有mysql這個用戶的話,最好做以下這步:

useradd -M -o -r -d /var/lib/mysql -s /bin/bash -c "MySQL Server" -u 27 mysql

然後我啟動mysql

/usr/local/mysql/bin/safe_mysqld &

ok,先看看mysql能否正常工作

mysql -uroot mysql

一般情況下都是不能正常鏈接資料庫,錯誤提示一般為:

ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

其實網上大家問的最多的都是整個問題,說什麼鏈接不到mysqld.sock,其實大家不妨看看mysql的錯誤日誌就明白怎麼回事,我這里的錯誤日誌是在

/var/lib/mysql/*.err 你會發現mysql只所以不能啟動,是因為/var/lib/mysql的許可權不允許mysql服務訪問,英文mysql默認是調用mysql用戶來啟動服務的,好了,既然知道是什麼原因找到不能啟動,那就簡單了。我們只要

chown -R mysql:mysql /var/lib/mysql 就行,如果還是啟動不了,再慢慢調試許可權,反正一般啟動不了都是許可權的問題。

如果大家還是不能啟動不了的話,那就用我的比較繁瑣的許可權的設置,反正我每次都是這么做的,一般不會有問題,見下:

chown -R root /usr/local/mysql
chgrp -R mysql /usr/local/mysql
chown -R root /usr/local/mysql/bin
chgrp -R mysql /usr/local/mysql/bin
chgrp -R mysql /var/lib/mysql
chmod 777 /var/lib/mysql
chown -R root /var/lib/mysql/mysql
chgrp -R mysql /var/lib/mysql/mysql
chmod 777 /var/lib/mysql/mysql
chown -R root /var/lib/mysql/mysql/*
chgrp -R mysql /var/lib/mysql/mysql/*
chmod 777 /var/lib/mysql/mysql/*
chmod 777 /usr/local/mysql/lib/mysql/libmysqlclient.a

做完上面的步驟,然後把你編譯目錄的一個腳本COPY過去

cp support-files/mysql.server /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

用ntsysv設置使mysql每次啟動都能自動運行。

好了,至此mysql安裝完畢,你可以這樣起動你的mysql服務

/etc/rc.d/init.d/mysqld start

下面這步比較關鍵,

ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql

大家可以不做這步,大可以在編譯其他軟體的時候自定義myslq的庫文件路徑,但我還是喜歡把庫文件鏈接到默認的位置,這樣你在編譯類似PHP,Vpopmail等軟體時可以不用指定mysql的庫文件地址。

2.安裝Apache1.3.29。我沒有選擇安裝Apache2.0是我對他還是不放心,因為網上最新公布的apache的漏洞基本上是針對2.0,當然大家可以自己選擇安裝相應的版本。我這里講的都是採用DSO動態編譯的方法編譯Apache.

至於有關apache的編譯方法,可以參考我以前的文章《apache的靜態/動態編譯在apache+php+mysql的應用》 http://www.5ilinux.com/apache01.html

軟體獲取:http://httpd.apache.org/

tar zvxf apache_1.3.29.tar.gz
cd apache_1.3.29
修改src/include/httpd.h 增大最大線程數

#define HARD_SERVER_LIMIT 256

改成

#define HARD_SERVER_LIMIT 2560

保存退出編譯apache

./configure --prefix=/usr/local/apache --enable-mole=so --enable-mole=rewrite --enable-shared=max --htdocsdir=/var/www &&
make &&
make install

#這里我們通過enable-mole參數告訴設置腳本,我們需要啟動so和rewrite模塊,so模塊是用來提DSO支持的apache核心模塊,而rewrite模塊則是用意實現地址重寫的模塊,由於rewrite模塊需要DBM支持,如果在初次安裝時沒有編譯進apache,以後需要用到時需要重新編譯整個apache才可以實現。為此除非你可以確定以後不會用到rewrite模塊,否則還是建議你在第一次編譯的時候把rewrite模塊編譯好。

enable-shared=max 這個參數的作用時編譯apache時,把除了so以外的所有apache的標准模塊都編譯成DSO模塊。而不是編譯進apache核心內。

好了安裝apache很簡單的哦,啟動apache看看

/usr/local/apache/bin/apachectl start

然後用ie看http://你的伺服器地址。應該能看到熟悉的apache羽毛標志。

3.安裝PHP4.3.4

軟體獲取:http://www.php.net/downloads.php

tar zvxf php-4.3.4.tar.gz
cd php-4.3.4

./configure \
--prefix=/usr/local/php \
--with-mysql=/usr/local/mysql \
--enable-force-cgi-redirect \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--with-gd --enable-gd-native-ttf \
--with-ttf \
--with-gdbm \
--with-gettext \
--with-iconv \
--with-jpeg-dir=/usr \
--with-png \
--with-zlib \
--with-xml \
--enable-calendar \
--with-apxs=/usr/local/apache/bin/apxs

make

make install

#我這里由於伺服器需要用到GD庫,所以加了一些支持GD的編譯參數 ,GD直接用了redhat自帶的GD庫,大家沒有安裝的話可以從安裝盤安裝,注意除了安裝GD以外,還要安裝libjpeg,libpng等庫文件。另外--with-mysql=/usr/local/mysql指向你安裝mysql的路徑。--with-apxs指向apache的apxs文件的路徑。

vi /usr/local/apache/conf/httpd.conf

查找

在此范圍添加

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

然CPOPY PHP的配置文件

cp ../php4.3.4/php.ini.dist /usr/local/php/lib/php.ini

修改php.ini文件
register_globals = On

ok!重新啟動一下apache伺服器
/usr/local/apache/bin/apachectl restart

然後寫個php測試頁info.php:內容如下

<?php
phpinfo();
?>
正常的話,應該能看到php的信息了,恭喜你的Apche+Mysql+PHP安裝成功。

好了寫了這么多,希望對大家有所幫助!!!

⑨ 配置php configure:error:Don't know how to define struct flock on this system,set-enable-opcache=no

能用現成點的lamp方案嗎?何必折騰已高度成熟的一鍵配置。

⑩ 編譯安裝的php5.6怎麼重啟

1.首先添加依賴應用
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel
這一步是為了支持一些php運行的東西,還有以下編譯需要的
2.安裝加密擴展庫
cd /usr/local/src/
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
3.到php壓縮包存放的目錄下
tar zxvf php-5.6.8.tar.gz #解壓
cd php-5.6.8 #進入文件夾
運行
[root@VPS php-5.6.8]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysql-sock --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-ncurses --enable-soap --with-libxml-dir --with-XMLrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear

熱點內容
隨機啟動腳本 發布:2025-07-05 16:10:30 瀏覽:528
微博資料庫設計 發布:2025-07-05 15:30:55 瀏覽:25
linux485 發布:2025-07-05 14:38:28 瀏覽:305
php用的軟體 發布:2025-07-05 14:06:22 瀏覽:756
沒有許可權訪問計算機 發布:2025-07-05 13:29:11 瀏覽:432
javaweb開發教程視頻教程 發布:2025-07-05 13:24:41 瀏覽:707
康師傅控流腳本破解 發布:2025-07-05 13:17:27 瀏覽:241
java的開發流程 發布:2025-07-05 12:45:11 瀏覽:686
怎麼看內存卡配置 發布:2025-07-05 12:29:19 瀏覽:285
訪問學者英文個人簡歷 發布:2025-07-05 12:29:17 瀏覽:835