We have a lot of success to achieve apache+php+mysql, online articles are also many, but I found a lot of articles are copied to copy, and did not explain the way of white compilation, Some simply apache1.3 the compilation method intact moved over the apache2.0, obviously misleading some rookie!
Today, apache+mysql+php to say the difference between static compilation and DSO dynamic compilation, I will take apache1.3.27 and apache2.0.46 respectively
Description, because the two versions of the compile command are different.
System and required software:
Redhat9.0
apache:1.3.27 and 2.0.46
php:4.3.2
mysql:4.0.13
first of all to install MySQL, this is not our focus, so the installation configuration about MySQL I will soon pass
Tar zvxf mysql-4.0.13.tar.gz
CD mysql-4.0.13
./configure--prefix=/usr/local/mysql--sysconfdir=/etc--localstatedir=/var/lib/mysql &&
Make &&
Make install
Installation is complete!
Then initialize the database
/usr/local/mysql/bin/mysql_install_db
Set permissions:
Chown-r Root/usr/local/mysql
Copy the configuration file;
Cp/usr/local/mysql/share/mysql/my-medium.cnf/etc/my.cnf
Start MySQL:
/use/local/mysql/bin/mysqld_safe--user=root &
Change Password: The initial root password is empty
/usr/local/mysql/bin/mysqladmin-u root-p Password 1234
Enter Password:
Change the password to 1234, because the initial password is empty, so enter password directly enter the line
Test the new password:
Mysql-u root-p MySQL
Enter password:1234
If it goes well, you can get into MySQL.
Okay, so much for MySQL, don't ask me any questions, I'm not very familiar with MySQL. Okay, here's our play, and I'll separate
Compile apache+php with static and dynamic DSO
As to what is static, what is the DSO dynamic I do not say much here, I personally tend to use DSO dynamic compilation.
The first is the static compilation of the apache1.3.29+php4.3.4+mysql4.0.13
Apache compiles for the first time and does not need to be installed because the PHP compilation requires that Apache have been compiled at least once
Tar zvxf apache_1.3.27.tar.gz
CD apache_1.3.27
./configure--prefix=/usr/local/apache
#编译php
Tar zvxf php4.3.4.tar.gz
CD php4.3.4
./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-apache=. /apache_1.3.27 &&
Make &&
Make install
#第二次编译安装apache:
Cd.. /apache_1.3.29
./configure--prefi=/usr/local/apache--activate-module=src/modules/php4/libphp4.a &&
Make &&
Make install
Cp.. /php4.3.4/php.ini.dist/usr/local/php/lib/php.ini
#修改/usr/local/apache/conf/httpd.conf
Find, add in this range
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
Note: Apache and PHP source packages are in the same directory,--with-apache=. /apache_1.3.27 is the directory that points to the source code decompression
#ok! Static compilation is complete, everyone just start the server
/usr/local/apache/bin/apachectl start
Then thousand PHP test page info.php: content as follows
Phpinfo ();
?>
Normal, should be able to see the PHP information, congratulations on your static compilation success!!!
Let's talk about the DSO dynamic compilation method:
First compile and install Apache
Tar zvxf apache_1.3.29
CD apache_1.3.29
./configure--prefix=/usr/local/apache--enable-module=so--enable-module=rewrite--enable-shared=max &&
Make &&
Make install
So module is used to provide DSO support Apachehe core module, rewrite is the address rewrite module, if not required can not compile
Enable-shared=max means that all standard modules except so are compiled into the DSO module.
Then compile PHP
Tar zvxf php4.3.4.tar.gz
CD php4.3.2
./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-apxs=/usr/local/apache/bin/apxs & &
Make &&
Make install
Then modify the Httpd.conf method with the static compilation method
OK,DSO dynamic compilation is completed, we should see Ming Tang come, the middle of what difference should see very clearly!!!
Next we talk about apache2.0.46+php4.3.2 compiling method, I here only say DSO dynamic compile, static compile really no time test, leave everyone to try.
Same as now compile and install Apache
Tar zvxf httpd-2.0.46.tar.gz
CD httpd-2.0.46
./configure--prefix=/usr/local/apache2--enable-so--enable-mods-shared=most &&
Make &&
Make install
It is noted that--enable-so is quite a--enable-module=so with 1.3.27, and--enable-mods-shared=most is equivalent to the previous
--enable-shared=max These differences we have to pay attention, or compile the wrong don't look for me
And then compile the PHP
Tar zvxf php4.3.2.tar.gz
./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-apxs2=/usr/local/apache2/bin/apxs & &
Make &&
Make install
Note here is APXS2!!!
Modify httpd.conf and 1.3.27 are also different, we look for add Type application/x-tar. tgz add below
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
In addition, to display Chinese words, modify:
Adddefaultcharset gb2312
Start Apache, please.
/usr/local/apache2/bin/apachectl start
Use that info.php test, should not have how big problem Oh!!!
Well written so much, hope to help you!!!
"Related articles"
http://www.bkjia.com/PHPjc/446780.html www.bkjia.com true http://www.bkjia.com/PHPjc/446780.html techarticle we have a lot of success to achieve apache+php+mysql, online articles are also many, but I found a lot of articles are copied to copy, and did not explain the way of white compilation, and some simply Apach ...