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

centos 下安装apache2.4.2+mysql5.5.7+php5.4

Jun 06, 2016 pm 08:07 PM
centos Install

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安装

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

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

Copy after login

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

1

2

3

4

5

6

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 //重启防火墙

Copy after login

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安装
安装一些常用的库

1

2

3

4

5

6

7

8

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

Copy after login

修改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 of this Website
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)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to input Chinese in centos How to input Chinese in centos Apr 07, 2024 pm 08:21 PM

Methods for using Chinese input in CentOS include: using the fcitx input method: install and enable fcitx, set shortcut keys, press the shortcut keys to switch input methods, and input pinyin to generate candidate words. Use iBus input method: Install and enable iBus, set shortcut keys, press the shortcut keys to switch input methods, and input pinyin to generate candidate words.

How to read USB disk files in centos7 How to read USB disk files in centos7 Apr 07, 2024 pm 08:18 PM

To read U disk files in CentOS 7, you need to first connect the U disk and confirm its device name. Then, use the following steps to read the file: Mount the USB flash drive: mount /dev/sdb1 /media/sdb1 (replace "/dev/sdb1" with the actual device name) Browse the USB flash drive file: ls /media/sdb1; cd /media /sdb1/directory; cat file name

How to enter root permissions in centos7 How to enter root permissions in centos7 Apr 02, 2024 pm 08:57 PM

There are two ways to enter the root authority of CentOS 7: use the sudo command: enter sudo su - in the terminal and enter the current user password. Log in directly as the root user: Select "Other" on the login screen, enter "root" and the root password. Note: Operate carefully with root privileges, perform tasks with sudo privileges, and change the root password regularly.

What to do if you forget your password to log in to centos What to do if you forget your password to log in to centos Apr 07, 2024 pm 07:33 PM

Solutions for forgotten CentOS passwords include: Single-user mode: Enter single-user mode and reset the password using passwd root. Rescue Mode: Boot from CentOS Live CD/USB, mount root partition and reset password. Remote access: Use SSH to connect remotely and reset the password with sudo passwd root.

SCP usage tips-recursively exclude files SCP usage tips-recursively exclude files Apr 22, 2024 am 09:04 AM

One can use the scp command to securely copy files between network hosts. It uses ssh for data transfer and authentication. Typical syntax is: scpfile1user@host:/path/to/dest/scp -r/path/to/source/user@host:/path/to/dest/scp exclude files I don't think you can when using scp command Filter or exclude files. However, there is a good workaround to exclude the file and copy it securely using ssh. This page explains how to filter or exclude files when copying directories recursively using scp. How to use rsync command to exclude files The syntax is: rsyncav-essh-

How to enable root permissions in centos7 How to enable root permissions in centos7 Apr 07, 2024 pm 08:03 PM

CentOS 7 disables root permissions by default. You can enable it by following the following steps: Temporarily enable it: Enter "su root" on the terminal and enter the root password. Permanently enabled: Edit "/etc/ssh/sshd_config", change "PermitRootLogin no" to "yes", and restart the SSH service.

How to obtain root permissions in centos7 How to obtain root permissions in centos7 Apr 07, 2024 pm 07:57 PM

There are several ways to gain root privileges in CentOS 7: 1. Run the command using "su". 2. Use "sudo" to run a single command. 3. Enable the root user and set a password. NOTE: Be cautious when using root privileges as they may damage the system.

How to enter root permissions in centos How to enter root permissions in centos Apr 07, 2024 pm 08:06 PM

There are two ways to perform tasks with root privileges in CentOS: 1) Use the sudo command to temporarily obtain root privileges; 2) Log in directly using the root user password. Extreme caution should be used when using root privileges and it is recommended to only use them when necessary.

See all articles