当前位置:首页 » 编程语言 » 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/ 目录。

热点内容
安卓80与90哪个更流畅 发布:2024-12-25 16:05:06 浏览:914
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