centos下安装php环境
安装apache
yum install httpd-devel
启动apache
/etc/init.d/httpd start
安装mysql
yum install mysql mysql-server
启动mysql
/etc/init.d/mysqld start
安装php
yum install php php-devel
重启apache加载php
/etc/init.d/httpd restart
网站根目录
/var/www/html
安装php扩展
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
重启apache
此方法安装出来的php版本为php5.1
卸载方法
yum -y erase http httpd-devel
yum -y erase mysql mysql-server mysql-devel
yum -y erase php php-devel php-mysql
这篇文章算yum安装lamp的升级版吧,默认在centos上yum安装php和mysql的话,版本比较低,当我们想用高版本的话,那就用其他yum源了,好了,来看安装教程吧.
系统:centos 5.x
需要软件包:
epel-release-5-4.noarch.rpm
remi-release-5.rpm
1.安装准备
##Install Remi Repository on RHEL/CentOS 5.0-5.9 - 32 Bit ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
##Install Remi Repository on RHEL/CentOS 5.0-5.9 - 64 Bit ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
2.安装apche php mysql
yum --enablerepo=remi,remi-test install httpd mysql mysql-server php php-common -y
3.安装apache扩展
yum --enablerepo=remi,remi-test install httpd-manual mod_ssl mod_perl mod_auth_mysql httpd-devel -y
4.安装php扩展
yum --enablerepo=remi,remi-test install php-mysql php-pgsql php-pecl-mongo php-sqlite \
php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli \
php-pear php-pdo php-redis
5.安装mysql扩展
yum --enablerepo=remi,remi-test install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
6.启动并验证
service mysqld start
service httpd start
chkconfig httpd on
chkconfig mysqld on
httpd -v
Server version: Apache/2.2.3
Server built: Sep 16 2014 11:05:09
php -v
PHP 5.4.40 (cli) (built: Apr 15 2015 16:05:43)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
mysql -V
mysql Ver 14.14 Distrib 5.5.43, for Linux (x86_64) using readline 5.1
好了,这样就可以了,安装结束.
apache:
如果采用RPM包安装,安装路径应在 /etc/httpd目录下
apache配置文件:/etc/httpd/conf/httpd.conf
Apache模块路径:/usr/sbin/apachectl
web目录:/var/www/html
如果采用源代码安装,一般默认安装在/usr/local/apache2目录下
php:
如果采用RPM包安装,安装路径应在 /etc/目录下
php的配置文件:/etc/php.ini
如果采用源代码安装,一般默认安装在/usr/local/lib目录下
php配置文件: /usr/local/lib/php.ini
或/usr/local/php/etc/php.ini
mysql:
如果采用RPM包安装,安装路径应在/usr/share/mysql目录下
mysqldump文件位置:/usr/bin/mysqldump
mysqli配置文件:
/etc/my.cnf或/usr/share/mysql/my.cnf
mysql数据目录在/var/lib/mysql目录下
如果采用源代码安装,一般默认安装在/usr/local/mysql目录下
yum -y install git
git --version