lamp:linux+apache+mysql+php Typical Configuration

Source: Internet
Author: User
Tags chmod include ini log php and mysql database linux

Debugging environment: Redhat9.0 Apache1.3.29 Mysql3.23.58 PHP4.3.4

Linux system installation I do not say, this is the basic skills, in fact, this article in similar redhat other Linux should also be universal, everyone as long as you master the method I provided on the line. Remember to install REDHAT9. Do not install system default Apache,mysql and PHP and related software when 0. Already installed, please remove the installed package with RPM-E *.

1. Install Mysql3.23.58

In fact, to be honest, directly install the MySQL official website provided by the RPM package is also a more feasible way, the RPM package on his official website is basically synchronized with the release of the TAR package, which I prefer, at least if you install the RPM package in the subsequent debugging will not appear in the MySQL library file can not find the situation. But here it is necessary to talk about the custom installation of the steps, after all, the user's custom installation also said quite a lot.

Software acquisition: http://www.mysql.com/downloads/index.html

Installation steps:

Tar zxvf mysql-3.23.58.tar.gz

CD mysql-3.23.58

./configure--prefix=/usr/local/mysql--sysconfdir=/etc--localstatedir=/var/lib/mysql

Make

Make install

#prefix =/usr/local/mysql mysql Installation target directory

Path to #sysconfdir =/etc my.ini configuration file

#localstatedir the path that the =/var/lib/mysql database stores

After installation to initialize the database, of course, you are upgraded without doing this step;

/usr/local/mysql/bin/mysql_install_db

If the system does not have MySQL this user, it is best to do the following step:

Useradd-m-o-r-d/var/lib/mysql-s/bin/bash-c "MySQL Server"-U-MySQL

And then I start MySQL.

/usr/local/mysql/bin/safe_mysqld &

OK, let's see if MySQL works.

Mysql-uroot MySQL

Generally, you cannot link the database properly, and the error message is generally:

ERROR 2002:can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)

In fact, everyone asked the most online is the whole problem, said what link not to mysqld.sock, in fact, we may wish to look at MySQL error log to understand how the matter, I here the error log is in

/var/lib/mysql/*.err you will find MySQL only so can not boot, because the/var/lib/mysql permission does not allow MySQL service access, English MySQL default is to invoke MySQL user to start the service, well, Now that you know what's the reason for not starting, it's easy. We just

Chown-r Mysql:mysql/var/lib/mysql on the line, if you still can not start, and then slowly debug permissions, anyway, generally can not start is the issue of permissions.

If we still can not start, then use my more cumbersome permission settings, anyway, I do it every time, generally will not have problems, 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

Finish the steps above, and then copy a script from your catalog to the past

CP Support-files/mysql.server/etc/rc.d/init.d/mysqld

Chkconfig--add mysqld

Use the NTSYSV setting to make MySQL run automatically every time you start.

All right, now that MySQL is installed, you can start your MySQL service.

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

The next step is more critical,

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

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

You can not do this, you can build other software to customize the MYSLQ of the library file path, but I still like to link the library file to the default location, so you can compile similar software such as Php,vpopmail without specifying MySQL's library file address.

2. Install Apache1.3.29. I did not choose to install Apache2.0 is I still not trust him, because the latest online release of the Apache vulnerability is basically for 2.0, of course, you can choose to install the appropriate version. I am talking here is the use of DSO dynamic compilation of the method of Apache.

As for the Apache compilation method, you can refer to my previous article "Apache Static/Dynamic compilation in Apache+php+mysql application" http://www.5ilinux.com/apache01.html

Software acquisition: http://httpd.apache.org/

Tar zvxf apache_1.3.29.tar.gz

CD apache_1.3.29

Modify Src/include/httpd.h to increase the maximum number of threads

#define HARD_SERVER_LIMIT 256

Change into

#define HARD_SERVER_LIMIT 2560

Save Exit Compile Apache

./configure--prefix=/usr/local/apache--enable-module=so--enable-module=rewrite--enable-shared=max--htdocsdir=/ Var/www &&

Make &&

Make install

#这里我们通过enable-module parameter tells the setup script, we need to start the so and rewrite modules, so module is used to mention the DSO support of the Apache core module, and rewrite module is intended to implement address rewrite module, Because the rewrite module requires DBM support, if you do not compile the Apache in the initial installation, you will need to recompile the entire Apache when you need to use it later. For this reason, unless you can be sure that you will not use the rewrite module, it is recommended that you compile the rewrite module at the first compile time.

Enable-shared=max This parameter when compiling Apache, all Apache standard modules except so are compiled into the DSO module. Instead of compiling it into the Apache core.

Okay, it's easy to install Apache. Oh, start Apache look

/usr/local/apache/bin/apachectl start

Then use IE to see http://your server address. Should be able to see the familiar Apache feather logo.

3. Install PHP4.3.4

Software acquisition: http://www.php.net/downloads.php

Tar zvxf php-4.3.4.tar.gz

CD php-4.3.4

./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-apxs=/usr/local/apache/bin/apxs

Make

Make install

#我这里由于服务器需要用到GD库, so added some support GD compiler parameters, GD directly with the Redhat with the GD library, we do not install the words can be installed from the installation disk, note In addition to the installation of GD, but also install libjpeg,libpng and other library files. Another--with-mysql=/usr/local/mysql points you to install the MySQL path. --with-apxs the path to the Apxs file that points to Apache.

Vi/usr/local/apache/conf/httpd.conf

Search ;

Add in this range

AddType application/x-httpd-php. php

AddType Application/x-httpd-php-source. Phps

However cpopy PHP's configuration file

Cp.. /php4.3.4/php.ini.dist/usr/local/php/lib/php.ini

modifying php.ini files

Register_globals = On

Ok! Restart Apache Server

/usr/local/apache/bin/apachectl restart

Then write a PHP test page info.php: The contents are as follows

Phpinfo ();

?>;

Normal, should be able to see the information of PHP, congratulations on your apche+mysql+php installation success.

All right, I've written so much to help!!!.

Refer to the Documentation:

Application of static/dynamic compilation of Apache in Apache+php+mysql



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.