Linux + Apache + MySQL + PHP Typical configuration

xiaoxiao2021-04-04  228

Debug environment: redhat9.0 apache1.3.29 mysql3.23.58 php4.3.4

I will not talk about the installation of the Linux system. This is the basic skill. In fact, this article should be common in other Linux similar to Redhat. Everyone will master the way I offer. Remember not to install the default Apache, MySQL, and PHP and related software when installing RedHat9.0. Please use rpm -e * to delete the installed package with rpm -e *.

1. Install mysql3.23.58

In fact, the RPM package provided by the official website is also a more feasible way. The RPM package of his official website is basically synchronized with the tar package. I prefer, at least the RPM package is installed. The mysql library file cannot appear in debugging. But there is still a need to talk about the steps of custom installation. After all, the netizen has a very much-defined installation.

Software Get: 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

# sysconfdir = / etc ini Path to Profile

# localstatedir = / var / lib / mysql data inventory Path

To initialize the database after installation, you don't have to do this if you are upgrading;

/ usr / local / mysql / bin / mysql_install_db

If the system doesn't have a mysql user, it is best to do the following:

UserAdd -M-O -R -D / VAR / LIB / MYSQL -S / BIN / BASH-C "MySQL Server" -u 27 mysql

Then I start MySQL

/ usr / local / mysql / bin / safe_mysqld &

OK, let's take a look at Mysql work properly.

MySQL -uroot mysql

Under normal circumstances, it is not a normal link database. The error prompt is generally:

Error 2002: Can't Connect To Local MySQL Server Through Socket '/VAR/LIB/Mysql/mysql.sock' (2)

In fact, everyone asks all the questions all the questions, saying what link is not mysqld.sock. In fact, everyone may wish to see what Mysql's error log understand what is going on, I here's the wrong log is

/var/lib/mysql/*.err You will find mysql only, because / var / lib / mysql permissions do not allow mysql service access, English MySQL default is to call mysql users to start the service, ok, Since you know what is the reason you can't start, it is simple. We only need

Chown -r mysql: mysql / var / lib / mysql is in line, if it is still not started, slowly adjust the permissions, anyway, it is generally not the problem.

If everyone still can't start, then use my more cumbersome permissions, anyway, I do this every time, I will generally don't have a 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 / limited 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 finished the steps above, then put a script for your compilation directory COPY

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

Chkconfig --Add MySQLD

Use NTSYSV settings to make MySQL each startup automatically.

Ok, until this mysql is installed, you can start your MySQL service like this.

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

The following steps are more important,

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

Everyone can do this, you can customize the MySLQ library file path when compiling other software, but I still like to link the library file to the default location so you can use software such as PHP, VPOPMAIL. MySQL library file address.

2. Install Apache1.3.29. I didn't choose to install apache2.0, I am still not assured to him, because the latest release of Apache on the Internet is basically targeted 2.0, of course, everyone can choose to install the corresponding version. I am talking about the use of DSO dynamic compilation.

As for the compilation method of Apache, you can refer to my previous article "Apache's static / dynamic compile in Apache PHP MySQL Application" http://www.5ilinux.com/apache01.html

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

TAR ZVXF apache_1.3.29.tar.gzcd apache_1.3.29 Modify SRC / include / httpd.h to increase the maximum number of threads

#define hard_server_limit 256

Change to

#define hard_server_limit 2560

Save an exit compile Apache

./configure --prefix = / usr / local / apache --enable-module = so --enable-module = rEWRITE --ENABLE-Shared = max --htdocsdir = / var / www && make & make

# Here we tell the setup script through the enable-module parameter, we need to start the SO and REWRITE modules, the SO module is used to mention the Apache core module supported by the DSO, and the REWRITE module is a module that is used to rewrite the address, due to the REWRITE module DBM support, if there is no compilation in Apache during the initial installation, you need to recompile the entire Apache in the future. To do this unless you can determine that the Rewrite module will not be used later, it is recommended that you compile the REWRITE module when you compile. When this parameter is compiled, when the action of this parameter is compiled, it is compiled into a DSO module except for all Apache other than SO. Instead of compiling into the Apache core.

It's very simple to install apache, start apache to see

/ usr / local / apache / bin / apachectl start

Then look at the http: // your server address. You should be able to see familiar Apache feathers.

3. Install PHP4.3.4

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

TAR ZVXF PHP-4.3.4.tar.gzcd PHP-4.3.4

./configure / - prefix = / usr / local / pHP / - with-mysql = / usr / local / mysql / --enable-force-cgi-redirect / - freetype-dir = / usr / -with-png-dir = / usr / - with-gd --Nable-gd-native-ttf / - with-ttf / - with-gdbm / - with-getText / - with-iconv / -with-jpeg-dir = / usr / - with-png / - l = / usr / local / APACHE / BIN / APXS

Make

Make Install

# I here, because the server needs to use the GD library, add some compilation parameters that support GD, GD uses the RedHat's own GD library. If you are not installed, you can install it from the installation disc, not to install the GD, Install libjpeg, libpng, etc. Also --with-mysql = / usr / local / mysql points to the path to you install MySQL. --with-apxs points to the path to the apxs file.

vi /usr/local/apache/conf/httpd.conf

Find

Add in this range

AddType Application / X-httpd-php .php Addtype Application / X-httpd-php-source .phps

CPOPY PHP configuration file

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

Modify php.ini file register_global = on

OK! Restart Apache Server / USR / local / apache / bin / apachectl restart

Then write a PHP test page info.php: The content is as follows

>

Normal, you should see the PHP information, congratulations on your APCHE MySQL PHP installation success.

转载请注明原文地址:https://www.9cbs.com/read-131838.html

New Post(0)