search
Homephp教程php手册centos 下安装apache2.4.2+mysql5.5.7+php5.4

apache2.4.2+mysql5.5.7+php5.4 Apache安装 wget http://mirror.bjtu.edu.cn/apache//apr/apr-1.4.6.tar.gzwget http://mirror.bjtu.edu.cn/apache//apr/apr-util-1.4.1.tar.gzwget http://apache.etoak.com//httpd/httpd-2.4.2.tar.gztar zxvf apr-1.4.6.ta

apache2.4.2+mysql5.5.7+php5.4
Apache安装

wget http://mirror.bjtu.edu.cn/apache//apr/apr-1.4.6.tar.gz
wget http://mirror.bjtu.edu.cn/apache//apr/apr-util-1.4.1.tar.gz
wget http://apache.etoak.com//httpd/httpd-2.4.2.tar.gz
tar zxvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure –prefix=/usr/local/apr
make
make install
tar zxvf apr-util-1.4.1.tar.gz
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/make
make install
tar zxvf httpd-2.4.2.tar.gz
cd httpd-2.2
./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --enable-vhost-alias --enable-expires --enable-rewrite --enable-authn-dbm=shared --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/
make
make install
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
chmod 755 /etc/rc.d/init.d/httpd
/etc/rc.d/init.d/httpd start

测试
lynx localhost
远程上不行,通过关闭防火墙
service iptables stop
远程就可以访问了
如果不想关闭防火墙,放开80端口即可。

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables save
#vi /etc/sysconfig/iptables
增加一行
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
#service iptables restart //重启防火墙

Mysql安装
使用rpm方式安装mysql
wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-server-5.5.27-1.linux2.6.i386.rpm
wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-client-5.5.27-1.linux2.6.i386.rpm
安装mysql
rpm –ivh MySQL-server-5.5.27-1.linux2.6.i386.rpm
rpm –ivh MySQL-client-5.5.27-1.linux2.6.i386.rpm
启动mysql
/usr/bin/mysqld_safe &
将mysql服务加入自动启动
查看mysql的运行状态
service mysql status
查看mysql是否在自动启动的列表中
chkconfig –list
如果不再加入
chkconfig –add mysql

php安装
安装一些常用的库

yum 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
wget http://cn2.php.net/distributions/php-5.4.5.tar.gz
tar zxvf php-5.4.5.tar.gz
cd php-5.4.5
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --prefix=/usr/local/php5 --disable-cgi --with-zlib --with-gettext --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap
make
make install
cp -p .libs/libphp5.so /usr/local/apache/modules

修改apache配置
# Make sure there’s only **1** line for each of these 2 directives:
# Use for PHP 4.x:
#LoadModule php4_module modules/libphp4.so
#AddHandler php-script .php

# Use for PHP 5.x:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php

# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php

AddType text/html .php

# PHP Syntax Coloring
# (optional but useful for reading PHP source for debugging):
AddType application/x-httpd-php-source phps

httpd.conf中加入php的配置文件
PHPINIDir /etc/php.ini

开起gd库php.ini中加入
extension=curl.so
session.auto_start=1

自动启动apache
vi /etc/rc.d/rc.local
加入
/usr/local/apache2/bin/httpd -f /usr/local/apache2/conf/httpd.conf

声明: 本文 ” centos 下安装apache2.4.2+mysql5.5.7+php5.4” 采用 BY-NC-SA 协议进行授权.

转载请注明本文链接地址: http://blog.ueder.info/934.html

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment