當前位置:首頁 » 編程語言 » centos安裝phpapache

centos安裝phpapache

發布時間: 2024-12-25 02:49:41

⑴ centos5 婧愮爜瀹夎匩ginx + mysql + apache + php鐨勬柟娉

涓昏佷緷鐓х殑鏄寮犲寸殑涓綃囧崥鏂囥http://blog.s135.com/post/366/銆嬶紝瀹夎呯殑杞浠舵槸涔熸槸浠庝粬鎻愪緵鐨勫垪琛ㄤ腑涓嬭澆錛岃繖閲岄兘鏄痶ar.gz鏍煎紡錛屽傛灉鏇村笇鏈涙槸rpm鏍煎紡鐨勮瘽錛屾彁渚涗竴涓緗戝潃銆http://rpmfind.net/linux/rpm2html/search.php銆嬭繖閲屽垪鍑轟簡姣旇緝瀹屽叏鐨勪笅杞藉寘銆

鎴戝畨瑁呯殑緋葷粺錛欳entos5

1銆佷笅杞斤紱

鎴戝畨瑁呯殑涓嬭澆鏉ヨ嚜寮犲村崥鏂囦笅鐨勫湴鍧錛屼笅杞戒繚瀛樼殑鏄痟ome涓嬭嚜宸辯洰褰曠殑涓涓鏂囦歡澶逛笅錛

澶嶅埗浠g爜

   

浠g爜濡備笅:

cd /home/xuxx/software

   wget http://blog.s135.com/soft/linux/nginx_php/nginx/nginx-0.7.51.tar.gz

   wget http://blog.s135.com/soft/linux/nginx_php/php/php-5.2.8.tar.gz

   wget http://blog.s135.com/soft/linux/nginx_php/phpfpm/php-5.2.8-fpm-0.5.10.diff.gz

   wget http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.1.33.zip

   wget http://blog.s135.com/soft/linux/nginx_php/libiconv/libiconv-1.13.tar.gz

   wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/libmcrypt-2.5.8.tar.gz

   wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz

   wget http://blog.s135.com/soft/linux/nginx_php/memcache/memcache-2.2.5.tgz

   wget http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz

   wget http://blog.s135.com/soft/linux/nginx_php/pcre/pcre-7.8.tar.gz

   wget http://blog.s135.com/soft/linux/nginx_php/eaccelerator/eaccelerator-0.9.5.3.tar.bz2

   wget http://blog.s135.com/soft/linux/nginx_php/pdo/PDO_MYSQL-1.0.2.tgz

   wget http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz

   wget http://blog.s135.com/soft/linux/nginx_php/imagick/imagick-2.2.2.tgz

2銆佸噯澶囩紪璇戝畨瑁呯幆澧冿紝闇瑕佺紪璇戞簮鐮佺敤鍒癵c++

寤鴻濡傛灉鏄鏂板畨瑁呯殑緋葷粺錛屼嬌鐢▂um upgrade鏇存柊涓嬬郴緇熴

澶嶅埗浠g爜

   

浠g爜濡備笅:

sudo -s

   LANG=C

   yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel

   glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel

   openldap openldap-devel nss_ldap openldap-clients openldap-servers

娉ㄦ剰錛氳繖閲屾墍鏈夌殑鍛戒護鏄涓琛岀殑鑰屼笉鑳芥湁鎹㈣岀︼紝濡傛灉鏄痗opy鐨勬椂鍊欙紝娉ㄦ剰瑕佸幓澶勮ユ崲琛岀

紜淇濆畨瑁呮垚鍔燂紒鎵嶈兘姝g『浣跨敤緙栬瘧銆

3銆佸畨瑁咃細

涓銆佸畨瑁匬HP 5.2.8錛團astCGI妯″紡錛

1銆佺紪璇戝畨瑁匬HP 5.2.8鎵闇鐨勬敮鎸佸簱錛

1錛 libiconv搴

澶嶅埗浠g爜

   

浠g爜濡備笅:

tar zxvf libiconv-1.13.tar.gz

   cd libiconv-1.13/

   ./configure --prefix=/usr/local

   make

   make install

   make clean

   make distclean

   cd ../

make clean 鍜宮ake distclean閮芥槸鍒犻櫎瀹夎呰繃紼嬩腑鐢熸垚鐨勭紦瀛樻枃浠躲傚綋鐒跺傛灉浣犱笉浠嬫剰鏀劇潃涔熷彲浠ヨ煩榪囪繖涓ゆユ竻鐞嗘搷浣溿

2錛絣ibmcrypt搴

澶嶅埗浠g爜

   

浠g爜濡備笅:

tar zxvf libmcrypt-2.5.8.tar.gz

   cd libmcrypt-2.5.8/

   ./configure

   make

   make install

   make clean

   make distclean

   /sbin/ldconfig

   cd libltdl/

   ./configure --enable-ltdl-install

   make

   make install

   make clean

   make distclean

   cd http://www.cnblogs.com/

3] mhash搴

澶嶅埗浠g爜

   

浠g爜濡備笅:

tar zxvf mhash-0.9.9.9.tar.gz

   cd mhash-0.9.9.9/

   ./configure

   make

   make install

   cd ../

4錛絤crypt搴

娉ㄦ剰錛氬洜涓鴻ュ簱鍜宭ibmcrypt鏈変緷璧栨э紝鎵浠ュ湪瀹夎呭墠蹇呴』鐭ラ亾libmcrypt錛屽惁鍒欑殑璇濅細鍑虹幇錛

閿欒

澶嶅埗浠g爜

   

浠g爜濡備笅:

checking for libmcrypt 鈥 version = 2.5.0鈥

   *** 鈥榣ibmcrypt-config 鈥搗ersion鈥 returned 2.4.0, but LIBMCRYPT (2.5.8)

   *** was found! If libmcrypt-config was correct, then it is best

   *** to remove the old version of LIBMCRYPT. You may also be able to fix the error

   *** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing

   *** /etc/ld.so.conf. Make sure you have run ldconfig if that is

   *** required on your system.

   *** If libmcrypt-config was wrong, set the environment variable LIBMCRYPT_CONFIG

   *** to point to the correct of libmcrypt-config, and remove the file config.cache

   *** before re-running configure

   configure: error: *** libmcrypt was not found

鏄鍥犱負path鐨勯棶棰橈紝鎵浠ユ墽琛岋細

澶嶅埗浠g爜

   

浠g爜濡備笅:

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la

   ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so

   ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4

   ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8

   ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a

   ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la

   ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so

   ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2

   ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

   ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

鐒跺悗鍐嶅畨瑁咃細

澶嶅埗浠g爜

   

浠g爜濡備笅:

tar zxvf mcrypt-2.6.8.tar.gz

   cd mcrypt-2.6.8/

   /sbin/ldconfig

   ./configure

   make

   make install

   cd ../

浜屻佸畨瑁卪ysql

澶嶅埗浠g爜

   

浠g爜濡備笅:

/usr/sbin/groupadd mysql

   /usr/sbin/useradd -g mysql xxx

   unzip mysql-5.1.33.zip

   cd mysql-5.1.33/

   ./configure --prefix=/usr/local/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables

   --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase

   make

   make install

   make clean

   make distclean

   chmod +w /usr/local/webserver/mysql

   chown -R xxx:mysql /usr/local/webserver/mysql

   cp support-files/my-medium.cnf.sh /usr/local/webserver/mysql/my.cnf

   cd ../

娉ㄦ剰錛氳繖閲岀紪璇./configure鍛戒護鏄涓琛岀殑鑰屼笉鑳芥湁鎹㈣岀︼紝濡傛灉鏄痗opy鐨勬椂鍊欙紝娉ㄦ剰瑕佸幓澶勮ユ崲琛岀

鍦ㄦ渶鍚庝竴姝ユ嫹璐濈殑鏃跺欙紝鎴戝畨瑁呭畬鍦╯upport-files涓嬫病鏈塵y-medium.cnf鑰屽彧鏈塵y-medium.cnf.sh鎵浠ュ皢榪欎釜鏂囦歡鎷瘋礉榪囧幓銆

錛犲紶瀹村師鏂囷細

闄勶細浠ヤ笅涓洪檮鍔犳ラわ紝濡傛灉浣犳兂鍦ㄨ繖鍙版湇鍔″櫒涓婅繍琛孧ySQL鏁版嵁搴擄紝鍒欐墽琛屼互涓嬩袱姝ャ傚傛灉浣犲彧鏄甯屾湜璁㏄HP鏀鎸丮ySQL鎵╁睍搴擄紝鑳藉熻繛鎺ュ叾浠栨湇鍔″櫒涓婄殑MySQL鏁版嵁搴擄紝閭d箞錛屼互涓嬩袱姝ユ棤闇鎵ц屻

鈶犮佷互xxx鐢ㄦ埛甯愬彿鐨勮韓浠藉緩絝嬫暟鎹琛錛

澶嶅埗浠g爜

   

浠g爜濡備笅:

/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/usr/local/webserver/mysql/data --user=xxx

鈶°佸惎鍔∕ySQL錛堟渶鍚庣殑琛ㄧず鍦ㄥ悗鍙拌繍琛岋級

澶嶅埗浠g爜

   

浠g爜濡備笅:

/bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/usr/local/webserver/mysql/my.cnf

3銆佺紪璇戝畨瑁匬HP錛團astCGI妯″紡錛

澶嶅埗浠g爜

   

浠g爜濡備笅:

tar zxvf php-5.2.8.tar.gz

   gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1

   cd php-5.2.8/

   ./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql

   --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib

   --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem

   --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect

   --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap

   --with-ldap-sasl

   make ZEND_EXTRA_LIBS='-liconv'

   make install

   cp php.ini-dist /usr/local/webserver/php/etc/php.ini

   cd ../

娉ㄦ剰錛氳繖閲./configure鍛戒護鏄涓琛岀殑鑰屼笉鑳芥湁鎹㈣岀︼紝濡傛灉鏄痗opy鐨勬椂鍊欙紝娉ㄦ剰瑕佸幓澶勮ユ崲琛岀

4銆佺紪璇戝畨瑁匬HP5鎵╁睍妯″潡--鍙閫夊畨瑁

澶嶅埗浠g爜

   

浠g爜濡備笅:

tar zxvf memcache-2.2.5.tgz

   cd memcache-2.2.5/

   /usr/local/webserver/php/bin/phpize

   ./configure --with-php-config=/usr/local/webserver/php/bin/php-config

   make

   make install

   make clean

   make distclean

   cd ../

   tar jxvf eaccelerator-0.9.5.3.tar.bz2

   cd eaccelerator-0.9.5.3/

   /usr/local/webserver/php/bin/phpize

   ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config

   make

   make install

   make clean

   make distclean

   cd ../

   tar zxvf PDO_MYSQL-1.0.2.tgz

   cd PDO_MYSQL-1.0.2/

   /usr/local/webserver/php/bin/phpize

   ./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql

   make

   make install

   make clean

   make distclean

   cd ../

   tar zxvf ImageMagick.tar.gz

   cd ImageMagick-6.5.1-2/

   ./configure

   make

   make install

   make clean

   make distclean

   cd ../

   tar zxvf imagick-2.2.2.tgz

   cd imagick-2.2.2/

   /usr/local/webserver/php/bin/phpize

   ./configure --with-php-config=/usr/local/webserver/php/bin/php-config

   make

   make install

   make clean

   make distclean

   cd ../

5銆佷慨鏀筽hp.ini鏂囦歡

STRONG鎵嬪伐淇鏀癸細/STRONG鏌ユ壘/usr/local/webserver/php/etc/php.ini涓鐨別xtension_dir = "./"

淇鏀逛負extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"

騫跺湪姝よ屽悗澧炲姞浠ヤ笅鍑犺岋紝鐒跺悗淇濆瓨錛

extension = "memcache.so"

extension = "pdo_mysql.so"

extension = "imagick.so"

鍐嶆煡鎵緊utput_buffering = Off

淇鏀逛負output_buffering = On

6銆侀厤緗甧Accelerator鍔犻烶HP錛

mkdir -p /usr/local/webserver/eaccelerator_cache

vi /usr/local/webserver/php/etc/php.ini

鎸塻hift+g閿璺沖埌閰嶇疆鏂囦歡鐨勬渶鏈灝撅紝鍔犱笂浠ヤ笅閰嶇疆淇℃伅錛

澶嶅埗浠g爜

   

浠g爜濡備笅:

[eaccelerator]

   zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"

   eaccelerator.shm_size="128"

   eaccelerator.cache_dir="/usr/local/webserver/eaccelerator_cache"

   eaccelerator.enable="1"

   eaccelerator.optimizer="1"

   eaccelerator.check_mtime="1"

   eaccelerator.debug="0"

   eaccelerator.filter=""

   eaccelerator.shm_max="0"

   eaccelerator.shm_ttl="300"

   eaccelerator.shm_prune_period="120"

   eaccelerator.shm_only="0"

   eaccelerator.compress="1"

   eaccelerator.compress_level="9"

淇鏀歸厤緗鏂囦歡錛

vi /etc/sysctl.conf

kernel.shmmax = 134217728

鐒跺悗鎵ц屼互涓嬪懡浠や嬌閰嶇疆鐢熸晥錛/sbin/sysctl -p

浠ヤ笅鐨勬ラゅ拰寮犲存ラや腑涓鏍烽厤緗錛屼笉鍐嶈禈璇

⑵ Centos虛擬機搭建的apache無法使用

Apache htdocs目錄下放好網頁文件
如果不是使用Apache預設訪問目錄,需要禁用selinux
啟動Apache服務
本機Firefox瀏覽器地址欄輸入http://localhost
Windows瀏覽器輸入IP地址即可,不用後面的localhost

⑶ centos安裝apache mysql php用YUM安裝與編譯安裝有什麼區別

YUM安裝:需要連接網路,依賴庫可以自動補全;
編譯安裝:自己下載安裝包,依賴包要自己補

⑷ 如何搭建lamp(CentOS7+Apache+MySQL+PHP)環境




在網上搜資料,自己在本地虛擬機上嘗試搭建,弄了整整一天一夜,終於弄好了.網上的資料,雖然很多,但大多都是重復的,拿去試了之後,又很多都不能得到正確的結果.最終找到了適合我的linux環境的搭建方式;在這里貼出來:度娘真不給力啊,沒搜出來靠譜的方法。最後用喜樂搜找到的靠譜的教程。

這里還是要總結一下我的LAMP環境的搭建步驟。我先在電腦里裝了虛擬機,在虛擬機中測試了數次之後,再在伺服器上搭建的。說說我的環境:虛擬機是:VMware® Workstation 12.1.1 Pro;Linux系統用的是:CentOS-7-x86_64-DVD-1511.iso;(阿里雲上也是用的CentOS7-64bit)准備好這兩個之後,就開始一步一步搭建我們的LAMP環境了。

一、安裝虛擬機

二、安裝CentOS7

注意:以下安裝,我都是用的root許可權。
三、安裝Apache1.安裝yum -y install httpd2.開啟apache服務systemctl start httpd.service3.設置apache服務開機啟動systemctl enable httpd.service4.驗證apache服務是否安裝成功在本機瀏覽器中輸入虛擬機的ip地址,CentOS7查看ip地址的方式為:ip addr(阿里雲不需要用這種方式查看,外網ip已經在你主機列表那裡給你寫出來了的;)這里是訪問不成功的(阿里雲用外網訪問,能成功,不需要做以下步驟)查了資料,說法是,CentOS7用的是Firewall-cmd,CentOS7之前用的是iptables防火牆;要想讓外網能訪問到apache主目錄,就需要做以下的操作:firewall-cmd --permanent --zone=public --add-service=httpfirewall-cmd --permanent --zone=public --add-service=httpsfirewall-cmd --reload然後再訪問外網ip,如果看到apache默認的頁面--有Testing 123...字樣,便是成功安裝了apache服務了;

四、安裝PHP1.安裝yum -y install php2.重啟apache服務systemctl restart httpd或者systemctl restart httpd.service然後,你可以寫一個php文件在瀏覽器中運行一下了;eg:vi /var/www/html/info.phpi<?php phpinfo(); ?>Esc:wq然後,在自己電腦瀏覽器輸入 192.168.1.1/info.php運行,會出現php的一些信息

五、安裝MySQL我這里根據所學的那個教程,也安裝了MariaDB1.安裝

yum -y install mariadb*
2.開啟MySQL服務systemctl start mariadb.service3.設置開機啟動MySQL服務systemctl enable mariadb.service4.設置root帳戶的密碼mysql_secure_installation然後會出現一串東西,可以仔細讀一下,如果你懶得讀,就在提示出來的時候,按Enter就好了,讓你設置密碼的時候,你就輸入你想要的密碼就行,然後繼續在讓你選擇y/n是,Enter就好了;當一切結束的時候,你可以輸入mysql -uroot -p的方式,驗證一下;

六、將PHP和MySQL關聯起來yum search php,選擇你需要的安裝:yum -y install php-mysql

七、安裝常用的PHP模塊例如,GD庫,curl,mbstring,...1.安裝:yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel2.重啟apache服務systemctl restart httpd.service然後,再次在瀏覽器中運行info.php,你會看到安裝的模塊的信息;

至此,LAMP環境就搭建好了。
如何搭建lamp(CentOS7+Apache+MySQL+PHP)環境
標簽:

⑸ 如何在CentOS6下實現Apache+PHP+MySQL的快速安裝

LAMP是一個免費、開源的解決方案,代表了Linux、Apache、MySQL、PHP,主要用作建立可行的通用的web伺服器。那麼如何在CentOS6下實現安裝Apache+php+Mysql的快速安裝?其具體安裝配置步驟可以如下進行:
1.准備工作
使用yum進行安裝,為了提高速度,最好先是修改為中國CentOS鏡像伺服器。目前國內有三個鏡像可以選擇,分別是:中國科學技術大學、163和Sohu的鏡像,建議教育網用戶選擇中科大,電信用戶選擇163
下面命令是備份CentOS-Base.repo文件,並修改使用163鏡像作為yum源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.save
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS6-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo

2.更新系統內核
yum -y update

3.安裝Apahce、Mysql、PHP
yum -y install httpd php mysql mysql-server

默認情況下,mysql數據目錄位於/var/lib/mysql
4.安裝相關組件:
yum install php-mysql php-gd php-imap php-ldap php-odbc
php-pear php-xml php-xmlrpc

5.安裝MySQL管理工具phpMyAdmin
yum -y install phpMyAdmin
6.配置Apache隨系統啟動
chkconfig --levels 235 httpd on
/etc/init.d/httpd start

7.配置MySQL隨系統啟動
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

8.設置資料庫root密碼
/usr/bin/mysqladmin -u root password 'New+Password#www.yupengyan.com'

9.測試PHP是否安裝成功
在 CentOS 中 Apache 的默認根目錄是 /var/www/html,配置文件 /etc/httpd/conf/httpd.conf。其他配置存儲在 /etc/httpd/conf.d/ 目錄。

熱點內容
sql2008視頻 發布:2024-12-25 15:56:59 瀏覽:498
c語言線程程序 發布:2024-12-25 15:56:06 瀏覽:366
我的世界神奇寶貝伺服器魔改版 發布:2024-12-25 15:50:38 瀏覽:720
如何找回公交雲辦公伺服器地址 發布:2024-12-25 15:48:18 瀏覽:540
無存儲功能非科學計算器 發布:2024-12-25 15:29:37 瀏覽:941
阿里雲伺服器恢復出廠設置 發布:2024-12-25 15:28:59 瀏覽:73
與演算法解析 發布:2024-12-25 15:28:53 瀏覽:444
無錫哪裡給密碼箱換輪子 發布:2024-12-25 15:16:42 瀏覽:723
伺服器主機有什麼功能 發布:2024-12-25 15:16:39 瀏覽:483
前目的地ftp 發布:2024-12-25 15:16:28 瀏覽:535