言歸正傳,開始安裝系統。
1,準備工作,首先要下載所需軟體的源碼包,有如下這些:
apr-1.5.2.tar.gz
apr-1.5.2.tar.gz tar.gz
pcre-8.36.tar.gz
httpd-2.4.17.tar.gz
php-5.6.15.
.所有的原始碼包上傳到伺服器。
2,安裝Apache2.4
apr-util-1.5.4 .tar.gz
pcre-8.36.tar.gz
tar zxvf aprz1.5.2.2.g. configure - -prefix=/usr/local/apr
make && make install
tar zxvf apr-util-1.5.4.tar.gz
tar zxvf apr-util-1.5.4.tar.gz.gz /configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
cd pcre-8.36
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install🜎的時候遇到如下錯誤:
You need a C++ compiler for C++ support
解決方案是:
yum install -y gcc gcc-c++
注意:這個-y千萬不能少。
可以開始安裝Apache了,
解壓縮
了,
解壓縮
Apache2 --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so--enable-rewrite
make && make install
注意:之前安裝的時候從windows上複製的./configure配置參數,結果中間不知為何多出來一些換行符,導致運行結果出錯了,所以正確指令的時候一定要小心。
2,安裝PHP5.6.15
解壓縮
Cd php-5.6.15
Cd php-5.6.15
去配置/configure --prefix=/usr/local/php--with-apxs2=/usr/local/Apache
2/bin/apxs --with-libxml-dir=/usr/include/libxml2--with-config -file-path=/usr/local/Apache2/conf --with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd--enable-gd-native-ttf --with-zlib --with-mcrypt--with-pdo-mysql=/usr/local/mysql --enable-shmop --enable-soap -- enable-sockets--enable-wddx --enable-zip --with-xmlrpc --enable-fpm --enable-mbstring--with-zlib-dir --with-bz2 --with-curl --enable-exif --enable-ftp--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-freetype-dir=/usr/lib/
於是乎乎遇到了一系列的報錯,推薦我之前的一篇文章介紹了常見錯誤的解決方法:
http://blog.csdn.net/dodott/article/details/49664379
我遇到的問題如下:
【錯誤】Configure: error: Please reinstall the BZip2 distribution apt-get install bzip2 -devel
【報錯誤】
configure: error: Please reinstall the libcurl distribution - /
解決方案:
centos: yum install curl curl-devel (For Redhat & Fedora)
l
🜕libpt 報價.
解決方案:
網上大部分給的方法是使用以下指令
yum install libmcrypt libmcrypt-devel (For Redhat & Fedora)
但是基本上都沒有作用,系統甚至會提示:nothing todothing。估計可能和YUM來源的軟體版本太低有關係。
正確做法是自己下載源碼來安裝:
libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
#編譯(默認安裝到/usr /local/lib/)
./configure --prefix=/usr/local/libmcrypt
注意:這裡的安裝路徑要記住,等到會安裝PHP的時候會用到。
繼續回到PHP的安裝,此時的設定參數修改為:
./configure --prefix=/usrwith/local/php=-flocal/php= /
Apache2/bin/apxs --with-libxml-dir=/usr/include/libxml2--with-config-file-path=/usr/local/Apache
2/conf --with-mysql= /usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd --enable-gd-native-ttf--with-zlib --with-pdo-mysql=/usr/local/mysql --enable-shmop --enable-soap--enable-sockets -- enable-wddx --enable-zip --with-xmlrpc --enable-fpm--enable-mbstring --with-zlib-dir --with-bz2 --with-curl --enable-exif--enable-ftp --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib--with-freetype-dir=/usr/lib/ --with-mcrypt=/usr/local/libmcrypt
修改內容是:去掉了--with-mcrypt,最後增加了--with-mcrypt=/usr/local/libmcrypt
error: Cannot find MySQL header files under/usr/local/mysql.
Note that the MySQL client library is not bundled anymore!
sql?庫。
但是本次安裝本身就不想安裝完整的mysql軟體,去php官網查了資料後找到如下一段翻譯文字:
「對於php-5.3.0或更新版本,mysqli 預設使用Mysql Native Driver作為My驅動器。 -apxs2=/usr/local/Apache
2/bin/apxs--with-libxml-dir=/usr/include/libxml2--with-config-file-path=/usr/local/
Apache--with-config-file-path=/usr/local/Apache
--with-config-file-path=/usr/local/Apache--with-config-file-path=/usr/local/
Apache--with-config-file-path=/usr/local/Apache
2/conf--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-gd --enable-gd-native-ttf--with-zlib --with-pdo-mysql=mysqlnd --enable-shmop --enable-soap--enable-sockets --enable-wddx --enable-zip --with-xmlrpc --enable-fpm--enable-mbstring --with-zlib-dir --with-bz2 --with-curl --enable-exif--enable -ftp --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib--with-freetype-dir=/usr/lib/ --with-mcrypt=/usr/local/libmcrypt
注意:上面紅色標記出來的目錄就是後面php.ini需要放置的目錄。
到此終於把PHP的configure成功通過。 make 和 makeinstall。 PHP安裝完畢。
3,修改PHP的設定檔php.ini
進入php原始碼目錄,選擇php.ini-development複製一份到/usr/local/ApacheApache
2/conf .ini使用vi打開,找出extension_dir,修改為extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20131226
",讀者依照自己的PHP安裝目錄結構配置,目的是找到PHP的擴充庫。
查找extension=php_,去掉extension=php_curl.dll,extension=php_gd2.dll,extension=php_mbstring.dll,extension=php_mysql.dll,extension=php_myi.dll,extension=php_mysql.dll,extension=php_myi.dll,exten_xml.dll前面 的分號。尋找short_open_tag = Off把它修改成short_open_tag = On,讓其支援短標籤(我看註釋這個預設是打開的)。
從別人的伺服器上我還拷貝瞭如下文件放到/usr/local/php/lib/php/extensions/no-de/usr/local/php/lib/php/extensions/no-de-檔案如下:Imap.soMcrypt.soMemcache.soOpenssl.so
Zip.so 然後在php.ini的最後增加如下設定文字extension=mcrypt.so
extension=zip.so
4,修改 /
Apache
/conf/httpd.conf
? 加入php支援。
【新增欄位一】
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php-source .phps
SetHandler application/x-httpd-php
?後面加上“ index.php”
DirectoryIndex index.html index.php
? 3. 不顯示目錄結構,找到“OptionsIndexes FollowSymLinks”,修改為🜎? Apache支援偽靜態,找到“AllowOverride None”,修改為
AllowOverride All
重啟提醒:實在不知道怎麼配置,就找個已經搭建成功的伺服器把設定檔弄過來比較一下。
此時還會遇到如下報錯:
httpd: Could not reliably determine
linux : /usr/local/
Apache/conf
用記事本打開httpd.conf
將裡面的#ServerName localhost:80註解去掉即可。
到此,整個
Apache+PHP5.6的環境搭建完畢。
推薦文章:
PHP的編譯安裝以上就介紹了CentOS65下安裝Apache24+PHP56,包括了Apache,準備工作,索引,安裝Apache方面的內容,希望對PHP教程有興趣的朋友有所幫助。

PHP類型提示提升代碼質量和可讀性。 1)標量類型提示:自PHP7.0起,允許在函數參數中指定基本數據類型,如int、float等。 2)返回類型提示:確保函數返回值類型的一致性。 3)聯合類型提示:自PHP8.0起,允許在函數參數或返回值中指定多個類型。 4)可空類型提示:允許包含null值,處理可能返回空值的函數。

PHP中使用clone關鍵字創建對象副本,並通過\_\_clone魔法方法定制克隆行為。 1.使用clone關鍵字進行淺拷貝,克隆對象的屬性但不克隆對象屬性內的對象。 2.通過\_\_clone方法可以深拷貝嵌套對象,避免淺拷貝問題。 3.注意避免克隆中的循環引用和性能問題,優化克隆操作以提高效率。

PHP適用於Web開發和內容管理系統,Python適合數據科學、機器學習和自動化腳本。 1.PHP在構建快速、可擴展的網站和應用程序方面表現出色,常用於WordPress等CMS。 2.Python在數據科學和機器學習領域表現卓越,擁有豐富的庫如NumPy和TensorFlow。

HTTP緩存頭的關鍵玩家包括Cache-Control、ETag和Last-Modified。 1.Cache-Control用於控制緩存策略,示例:Cache-Control:max-age=3600,public。 2.ETag通過唯一標識符驗證資源變化,示例:ETag:"686897696a7c876b7e"。 3.Last-Modified指示資源最後修改時間,示例:Last-Modified:Wed,21Oct201507:28:00GMT。

在PHP中,應使用password_hash和password_verify函數實現安全的密碼哈希處理,不應使用MD5或SHA1。1)password_hash生成包含鹽值的哈希,增強安全性。 2)password_verify驗證密碼,通過比較哈希值確保安全。 3)MD5和SHA1易受攻擊且缺乏鹽值,不適合現代密碼安全。

PHP是一種服務器端腳本語言,用於動態網頁開發和服務器端應用程序。 1.PHP是一種解釋型語言,無需編譯,適合快速開發。 2.PHP代碼嵌入HTML中,易於網頁開發。 3.PHP處理服務器端邏輯,生成HTML輸出,支持用戶交互和數據處理。 4.PHP可與數據庫交互,處理表單提交,執行服務器端任務。

PHP在過去幾十年中塑造了網絡,並將繼續在Web開發中扮演重要角色。 1)PHP起源於1994年,因其易用性和與MySQL的無縫集成成為開發者首選。 2)其核心功能包括生成動態內容和與數據庫的集成,使得網站能夠實時更新和個性化展示。 3)PHP的廣泛應用和生態系統推動了其長期影響,但也面臨版本更新和安全性挑戰。 4)近年來的性能改進,如PHP7的發布,使其能與現代語言競爭。 5)未來,PHP需應對容器化、微服務等新挑戰,但其靈活性和活躍社區使其具備適應能力。

PHP的核心優勢包括易於學習、強大的web開發支持、豐富的庫和框架、高性能和可擴展性、跨平台兼容性以及成本效益高。 1)易於學習和使用,適合初學者;2)與web服務器集成好,支持多種數據庫;3)擁有如Laravel等強大框架;4)通過優化可實現高性能;5)支持多種操作系統;6)開源,降低開發成本。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

Atom編輯器mac版下載
最受歡迎的的開源編輯器

Dreamweaver CS6
視覺化網頁開發工具

Dreamweaver Mac版
視覺化網頁開發工具