centos6.5 down rpm offline installation apache2.2+php5.5+mysql5.6

Source: Internet
Author: User

1, installation, MySQL

See website: http://bt9527.blog.51cto.com/9142217/1437877

2, install Apache

Download the Apache for Linux source package on the following page
http://www.apache.org/dist/httpd/
I put it under the/home/directory.

Unzip:
TAR-ZXVF httpd-*.tar.gz
MV httpd-* Apache
Execute command:
CD Apache
./configure--prefix=/usr/local/apache2--enable-module=so
Make
Make install
Default installation Apache path in/usr/local/apache2

3, install PHP

Download the PHP for Linux source package on the following page
http://www.php.net/downloads.php
I put it under the/home/directory.
TAR-ZXVF php-*.tar.gz
MV php-* PHP
CD PHP

./configure--prefix=/usr/local/php--with-mysql=/usr--with-mysqli=/usr/bin/mysql_config--with-apxs2=/usr/local/ Apache2/bin/apxs--with-zlib=/usr/

It's easy to make mistakes here, I've been stuck here for a long time
--prefix=/usr/local/php Specifying the PHP installation directory
--WITH-APXS2=/USR/LOCAL/APACHE2/BIN/APXS Apache Association, mainly PHP support module compiled directly into Apache's modules directory
--WITH-MYSQL=/USR offline RPM Package installation MySQL header file location
--with-zlib=/usr/offline RPM Installation zlib header file location

The error that occurred:
Error 1:cannot find MySQL header files under *******
One reason is that the location of the header file is not found (usually found).
The second reason is written/usr/include/mysql (I am in this error, obviously the head file is in this directory inside, how can not find?
Find mysql.h inside configure, the result found this sentence if Test-r $PHP _mysql/include/mysql/mysql.h; The original script put/include/mysql/ Mysql.h included, so the parameters inside the MySQL header file only need to write to the directory Liclude front level directory/usr/on the line. )
Error 2:configure:error:xml2-config not found.
Workaround:
Download and install the following software on the Rpmfind.net website according to the operating system
RPM-IVH libxml2-python*
RPM-IVH zlib-devel*
RPM-IVH libxml2-devel*
Error 3: Missing zlib
Find the zlib directory with the command Whereis zlib
Zlib:/usr/include/zlib.h/usr/share/man/man3/zlib.3.gz
Add a sentence--with-zlib=/usr #这里/include/zlib.h in the script also wrote, the parameters do not
Error 4:configure:error:mysql configure failed. Please check the Config.log for more information.
This error almost grasp the crash, online find all kinds of solutions are so pit, and some say no MySQL header file, this header file I added, and someone said parameter--with-mysql= .... Written--with-mysql-dir= ..., so the solution of the people did not find that the final word of the compilation:
Configure:WARNING:unrecognized Options:--with-mysql-dir
This sentence means that you do not have PHP associated with MySQL. You will be re-installed if you want to use normal.
The solution to that 64-bit operating system is reliable, but my system is 32-bit.
Finally found a brother to write the solution on the blog:
Download and install mysql-embedded-5.6.19-1.el6.i686.rpm
mysql-shared-5.6.19-1.el6.i686.rpm
mysql-shared-compat-5.6.19-1.el6.i686.rpm
Compile finally see thank you for using PHP.

and then compile
Make
This can be tested with make test, or not.
Make install

4. Configuration
PHP configuration file
CP Php.ini-development/usr/local/lib/php.ini
I did not make PHP changes
Apache configuration file
Vi/usr/local/apache2/conf/httpd.conf
Make the following configuration for Apache
Change serveradmin Mailto:[email protected] line to your e-mail address
DocumentRoot "/usr/local/apache2/htdocs" at the same time as the HTML file home directory, I did not modify, use the default directory
#设置apache的默认文件名次序
AddType application/x-httpd-php. php. phtml. PhP3. Inc
AddType Application/x-httpd-php-source. Phps
ServerName 192.168.10.45:80 setting up the server IP
Only modify these, not familiar with the configuration file, no other changes, if necessary, then fill

5. Start the service
/usr/local/apache2/bin/apachectl start

6. Testing
vi/usr/local/apache2/htdocs/1.php
<?php
Phpinfo ();
?>
The installed PHP information will appear in the browser input/HTTP/server ip/1.php.

Test PHP to read MySQL data, first login MySQL
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
| Test |
+--------------------+
4 rows in Set (0.01 sec)
Mysql>use Test
Mysql> CREATE TABLE MClass (ID int (4) NOT null primary key Auto_increment,name char (a) not null,sex int (4) is NOT null Def Ault ' 0 ', degree double (16,2));
mysql> INSERT INTO MClass values ("9527", "Zhouxc", "1", "22");
Query OK, 1 row affected (0.03 sec)

mysql> INSERT INTO MClass values ("9528", "Dema", "1", "33");
Query OK, 1 row affected (0.05 sec)

mysql> INSERT INTO MClass values ("9529", "Duandao", "0", "99");
Query OK, 1 row affected (0.04 sec)

vi/usr/local/apache2/thdocs/sql.php
Code:
<?php
echo "This is a test</br>";
echo "ASDFASDFADSF";
$mysql _server_name= "localhost:3306"; Database server name
$mysql _username= "root"; Connect to database user name
$mysql _password= "123456"; Connect Database Password
$mysql _database= "Test"; The name of the database

Connecting to a database
$conn =mysql_connect ($mysql _server_name, $mysql _username,
$mysql _password);

SQL statement that extracts information from a table
$strsql = "SELECT * from MClass";
Execute SQL query
$result =mysql_db_query ($mysql _database, $strsql, $conn);
Get query Results
$row =mysql_fetch_row ($result);

Echo ' <font face= ' Verdana > ';
Echo ' <table border= ' 1 "cellpadding=" 1 "cellspacing=" 2 ">";

Show Field names
echo "</b><tr></b>";
for ($i =0; $i <mysql_num_fields ($result); $i + +)
{
Echo ' <td bgcolor= ' #000F00 ><b> '.
Mysql_field_name ($result, $i);
echo "</b></td></b>";
}
echo "</tr></b>";
Navigate to the first record
Mysql_data_seek ($result, 0);
Loop out Records
while ($row =mysql_fetch_row ($result))
{
echo "<tr></b>";
for ($i =0; $i <mysql_num_fields ($result); $i + +)
{
Echo ' <td bgcolor= ' #00FF00 > ';
echo $row [$i];
Echo ' </td> ';
}
echo "</tr></b>";
}
echo "</table></b>";
echo "</font>";
Freeing resources
Mysql_free_result ($result);
Close connection
Mysql_close ($conn);
?>
In the browser input/HTTP/server ip/sql.php
Show:
This is a test
Asdfasdfadsf
ID Name Sex degree
9527 ZHOUXC 1 22.00
9528 Dema 1 33.00
9529 Duandao 0 99.00


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.