Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The installation and configuration method of Linux+Apache2+Mysql+Php

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "the installation and configuration method of Linux+Apache2+Mysql+Php". In the daily operation, I believe that many people have doubts about the installation and configuration method of Linux+Apache2+Mysql+Php. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "installation and configuration method of Linux+Apache2+Mysql+Php". Next, please follow the editor to study!

Install and configure Mysql, Apache2 and PHP completely under this Linux to solve the error when installing Mysql: Character set 'gbk' is not a compiled character set and is not specified in the / usr/local/mysql/share/mysql/charsets/Index.xml' file

After installing mysql, you can find the mysql installation configuration information description / usr/local/mysql/info/mysql.info in the following directory

[@ more@]

Install and configure Mysql, Apache2 and PHP completely under this Linux to solve the error when installing Mysql: Character set 'gbk' is not a compiled character set and is not specified in the / usr/local/mysql/share/mysql/charsets/Index.xml' file

After installing mysql, you can find the mysql installation configuration information description / usr/local/mysql/info/mysql.info in the following directory

#

1. Check the system and kernel status

[root@app /] # cat / etc/issue

Red Hat Enterprise Linux AS release 4 (Nahant)

Kernel r on an m

[root@app /] # cat / proc/version

Linux version 2.6.9-5.ELsmp (bhcompile@decompose.build.redhat.com) (gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)) # 1 SMP Wed Jan 5 19:30:39 EST 2005

[root@app /] # uname-r

2.6.9-5.ELsmp

1.1 View CPU and MEM

[root@app /] # grep "model name" / proc/cpuinfo

Model name: Intel (R) Xeon (R) CPU 5130 @ 2.00GHz

Model name: Intel (R) Xeon (R) CPU 5130 @ 2.00GHz

Model name: Intel (R) Xeon (R) CPU 5130 @ 2.00GHz

Model name: Intel (R) Xeon (R) CPU 5130 @ 2.00GHz

[root@app /] # grep MemTotal / proc/meminfo

MemTotal: 4147280 kB

1.2 operating system bits

[root@app /] # getconf LONG_BIT

thirty-two

[root@app /] # ldd / sbin/mii-tool

Libc.so.6 = > / lib/tls/libc.so.6 (0x0097e000)

/ lib/ld-linux.so.2 (0x00965000)

two。 Get ready to install the package

Mysql-5.0.45.tar.gz

Mysql-5.0.45-linux-i686-glibc23.tar.gz

Httpd-2.2.4.tar.gz

Php-4.4.7.tar.gz

3. Install and configure

3.1 check whether the corresponding Mysql,php,apache package has been installed on the system

# rpm-qa | grep mysql and # rpm-qa | grep MySQL

Rpm-Q-a | grep-I mysql

Rpm-Q-a | grep-I httpd

Rpm-Q-a | grep-I php

If no message starting with mysql or MySQL is returned, it is not installed. If it is already installed, you can use or replace the new version directly

Uninstall method:

# rpm-e mysql-xxxxxx

# rpm-e httpd-xxxxxx

# rpm-e php-xxxxxx

If you encounter dependency problems and cannot uninstall, you can use-- nodeps or-force to force uninstall. But it's best to use it with caution.

Rpm-e-nodeps httpd

Rpm-e-nodeps php

3.2 for installation

Cp mysql-5.0.45.tar.gz / tmp

Cp mysql-5.0.45-linux-i686-glibc23.tar.gz / tmp

Cp httpd-2.2.4.tar.gz / tmp

Cp php-4.4.7.tar.gz / tmp

Installation of version 3.3 Mysql-5.0.45

Cd / tmp

Tar xvfz mysql-5.0.45.tar.gz

Cd / mysql-5.0.45

. / configure-prefix=/usr/local/mysql-with-extra-charsets=gbk-with-charset=gbk-sysconfdir=/etc-localstatedir=/var/lib/mysql

Make

Make install

Specifies that the character type is gbk for compilation and installation

# destination directory for prefix=/usr/local/mysql mysql installation

# path to the sysconfdir=/etc my.cnf configuration file

# path where the localstatedir=/var/lib/mysql database is stored

Initialize the database after installation. Of course, if you upgrade, you don't have to do this step.

/ usr/local/mysql/bin/mysql_install_db-- user=mysql

Installing MySQL system tables...

OK

Filling help tables...

OK

To start mysqld at boot time you have to copy

Support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER!

To do so, start the server, then issue the following commands:

/ usr/local/mysql/bin/mysqladmin-u root password' new-password'

/ usr/local/mysql/bin/mysqladmin-u root-h app.shunde.gov.cn password' new-password'

See the manual for more instructions.

You can start the MySQL daemon with:

Cd / usr/local/mysql; / usr/local/mysql/bin/mysqld_safe &

There is a prompt for the message to

Cp / usr/local/mysql/share/mysql/mysql.server / etc/rc.d/init.d/mysqld

Cp / usr/local/mysql/share/mysql/my-huge.cnf / etc/my.cnf

/ usr/local/mysql/bin/mysqladmin-u root password'*'

Start Mysql for testing

/ etc/rc.d/init.d/mysqld status

/ etc/rc.d/init.d/mysqld start

If you still can't start it, then use my more tedious permission settings. Anyway, I do this every time, and there is usually no problem. See below:

Chown-R root / usr/local/mysql

Chgrp-R mysql / usr/local/mysql

Chown-R root / usr/local/mysql/bin

Chgrp-R mysql/ usr/local/mysql/bin

Chgrp-R mysql / var/lib/mysql

Chmod 777 / var/lib/mysql

Chown-R root / var/lib/mysql/mysql

Chgrp-R mysql/ var/lib/mysql/mysql

Chmod 777 / var/lib/mysql/mysql

Chown-R root / var/lib/mysql/mysql/*

Chgrp-R mysql/ var/lib/mysql/mysql/*

Chmod 777 / var/lib/mysql/mysql/*

Chmod 777 / usr/local/mysql/lib/mysql/libmysqlclient.a

Ln-s / usr/local/mysql/lib/mysql / usr/lib/mysql

Ln-s / usr/local/mysql/include/mysql / usr/include/mysql

There may also be the following errors

/ usr/local/mysql/bin/mysqladmin: Character set 'gbk' is not a compiled character set and is not specified in the

'/ usr/local/mysql/share/mysql/charsets/Index.xml' file

/ usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed

Error: 'Can't initialize character set gbk (path: / usr/local/mysql/share/mysql/charsets/)

Now to find the solution is to use the mysql-5.0.45-linux-i686-glibc23.tar.gz patch pack.

Cd / tmp

Tar xvfz mysql-5.0.45-linux-i686-glibc23.tar.gz

Cp / usr/local/mysql / usr/local/old_mysql

Rm-rf / usr/local/mysql

Cp mysql-5.0.45-linux-i686-glibc23 / usr/local/mysql

Restart Mysql and there is no error from gbk

Continue to modify the parameter configuration of / etc/my.cnf, adding default-character-set=gbk to the following location

[client]

Default-character-set=gbk

[mysqld]

Default-character-set=gbk

Restart Mysql

/ etc/rc.d/init.d/mysqld restart

Log in to Mysql

/ usr/local/mysql/bin/mysql-uroot-p *

Mysql > SHOW VARIABLES LIKE 'char%'

+-+

| | Variable_name | Value |

+-+

| | character_set_client | gbk |

| | character_set_connection | gbk |

| | character_set_database | gbk |

| | character_set_filesystem | binary |

| | character_set_results | gbk |

| | character_set_server | gbk |

| | character_set_system | utf8 |

| | character_sets_dir | / usr/local/mysql/share/mysql/charsets/ |

+-+

8 rows in set (0.01 sec)

Change it to the required character type gbk as shown in the above figure

[root@app bin] # / usr/local/mysql/bin/mysqlshow-uroot-p *

[root@app bin] # / usr/local/mysql/bin/mysqlcheck-A-uroot-p *

3.3.1 transfer mysql data, first export to * .sql from the old library, and then import to the new library

[root@house] # / usr/local/mysql/bin/mysqldump-uroot-p * db1 > / opt/db1_bakup.20080304.sql

[root@house] # / usr/local/mysql/bin/mysqldump-uroot-p * db2 > / opt/db2_bakup.20080304.sql

[root@house] # / usr/local/mysql/bin/mysql-uroot-p * db1 < / opt/db1_bakup.20080304.sql

[root@house] # / usr/local/mysql/bin/mysql-uroot-p * db2 < / opt/db2_bakup.20080304.sql

3.4 install Apache-2.2.4

Cd / tmp

Tar xvfz httpd-2.2.4.tar.gz

Cd / httpd-2.2.4

. / configure-prefix=/usr/local/apache2-enable-module=so-enable-module=rewrite-enable-shared=max

-- start apache

/ usr/local/apache2/bin/apachectl start

-- close apache

/ usr/local/apache2/bin/apachectl stop

3.5 install php-4.4.7

Cd / tmp

Tar xvfz php-4.4.7.tar.gz

Cd / php-4.4.7

[root@app php-4.4.7] # / configure-- prefix=/usr/local/php-- with-mysql=/usr/local/mysql-- enable-force-cgi-redirect-- with-freetype-dir=/usr-- with-png-

Dir=/usr-with-gd-enable-gd-native-ttf-with-ttf-with-gdbm-with-gettext-with-iconv-with-jpeg-dir=/usr-with-png-with-zlib-with-xml

Enable-calendar-with-apxs2=/usr/local/apache2/bin/apxs

Make

Make install

3.5.1 configuring php.ini

/ usr/local/php/lib/php.ini

At this point, the study on the "method of installation and configuration of Linux+Apache2+Mysql+Php" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report