Fedora 17 上安装 AMP 服务(Apache MySQL PHP)
1)安装Mysql
- yum install mysql mysql-server
- systemctl start mysqld.service
- systemctl enable mysqld.service
- mysqladmin -u root password XXXXXXX
- mysql -h localhost -u root –p
(2)安装apache
- #yum -y install httpd
- 修改配置文件
- #vi /etc/httpd/conf/httpd.conf
- # line 43: change
- ServerTokens Prod
- # line 75: change to ON
- KeepAlive On
- # line 330: change (enable CGI and disable Indexes)
- Options FollowSymLinks ExecCGI
- # line 337: change
- AllowOverride All
- # line 401: add file name that it can access only with directory's name
- DirectoryIndex index.html index.cgi index.php
- # line 535: change
- ServerSignature Off
- # line 758: make it comment
- #AddDefaultCharset UTF-8
- # line 795: uncomment and add file-type that apache looks them CGI
- AddHandler cgi-script .cgi .pl
(3)安装php
- #yum install php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
- 启动服务
- #systemctl start httpd.service
- #systemctl enable httpd.service
- # chkconfig --levels 235 httpd on
- 编写一个文件测试一下
- #vi /var/www/html/info.php
- <?php
- phpinfo();
- ?>
(4)安装mysql管理工具phpmyadmin
#yum -y install phpMyAdmin php-mysql php-mcrypt
修改配置文件
- #vi /etc/httpd/conf.d/phpMyAdmin.conf
- # line 14: add IP address you allow
- Allow from 127.0.0.1 192.168.1.0/24
- # systemctl restart httpd.service