The first part installs the mysql-apache-php

Source: Internet
Author: User
Tags install php mcrypt phpinfo mysql view


1. Install MySQL
cd/usr/local/src/
No installation of compiled binary packages
wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz

Tar zxvf/usr/local/src/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz Decompression
MV Mysql-5.1.40-linux-i686-icc-glibc23/usr/local/mysql move to MySQL and rename to MySQL

Useradd-s/sbin/nologin mysql Add a MySQL user not to let it log in
Mkdir-p/data/mysql to store MySQL data

Cd/usr/local/mysql

Chown-r Mysql:mysql/data/mysql
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql Initialize, to run some MySQL necessary files MySQL table, database placed in/data/mysql

echo $?

]# Ls/data/mysql
MySQL Test
The MySQL library is generated

MySQL] #ls support-files/
MySQL] #cp support-files/mysql.server/etc/init.d/mysqld mysql startup script = =
It's here to put it in the system's list of services.

chmod 755/etc/init.d/mysqld

Chkconfig--add mysqld
Chkconfig mysqld on


Vim/etc/init.d/mysqld need to modify the configuration file ================
Add the following content
Basedir=/usr/local/mysql the path where MySQL resides
Datadir=/data/mysql to store MySQL data


mysql]# ls support-files/
My-huge.cnf
My-large.cnf
My-small.cnf


The CP support-files/my-huge.cnf/etc/my.cnf can also open my.cnf to modify his port
There's a configuration inside vim/etc/my.cnf.
Note the following two lines, is the master from the use of, to prevent the excessive use of resources,
#log-bin=mysql-bin
#server-id = 1


Service mysqld Start
Or
/etc/init.d/mysqld start MySQL startup script ========================

PS aux |grep mysqld
NETSTAT-LNP |grep MySQL

Ls/data/mysql View the generated files
Can look at the error log


2. Installing Apache
wget http://syslab.comsenz.com/downloads/linux/httpd-2.2.16.tar.gz
Tar zvxf httpd-2.2.16.tar.gz
CD httpd-2.2.16

./configure--prefix=/usr/local/apache2--with-included-apr--with-pcre--enable-mods-shared=most
Prefix back is the directory where Apache is installed, Apr allows us to use apache,pcre called regular correlation on multiple platforms, followed by modules

If it goes wrong, you need to install GCC and Apr yum install-y gcc Apr
echo $?

Make
Make install
Ls/usr/local/apache2/can view the generated files

Launch Apache
/usr/local/apache2/bin/apachectl start
PS aux |grep httpd

"httpd-2.4 version Compilation installation Method" Http://www.aminglinux.com/bbs/thread-7283-1-1.html
2.2 used his own apr,2.4 to use the system's Apr.
"How to specify the use of Worker/prefork" http://www.lishiming.net/thread-944-1-1.html
"Apache two mode of operation" http://www.lishiming.net/thread-838-1-2.html


PHP must be installed after the previous two

3. Install PHP
wget http://cn2.php.net/distributions/php-5.3.28.tar.gz
Tar zxf php-5.3.28.tar.gz

CD php-5.3.28 Install the required packages and proceed with the following actions
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/ Php/etc--with-mysql=/usr/local/mysql--with-libxml-dir--with-gd--with-jpeg-dir--with-png-dir--with-freetype-dir --with-iconv-dir--with-zlib-dir--with-bz2--with-openssl--with-mcrypt--enable-soap--enable-gd-native-ttf-- Enable-mbstring--enable-sockets--enable-exif--disable-ipv6

If the installation error is missing some libraries, you need to install Yum install-y libxml2-devel like this, followed by-devel
(You can look up yum list |grep bzip2 when you're not sure.)


Note that at the end of the MCrypt this package, you need to install the Epel extension source to see
Otherwise yum list |grep MCrypt is not searchable mcrypt

Centos6
32-bit Epel yum Source: wget www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm
64-bit: www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm

RPM-IVH epel-release-6-8_32.noarch.rpm

Then you can search for Yum list |grep MCrypt

Centos6
32-bit Epel yum Source: www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm
64-bit: www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm

When you're done downloading
Rpm-ivh ' www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm '

Yum install-y Libmcrypt-devel Before you can successfully install this


Make
Make install


"php5.5, 5.6 Compile installation Method" http://www.aminglinux.com/bbs/thread-7284-1-1.html

=========================================================mysql,apache,php installation is complete.

4. Configure Apache with PHP
vim/usr/local/apache2/conf/httpd.conf Apache configuration file, inside and many modules

Path to the Ls/usr/local/apache2/modules/apache module

/usr/local/apache2/bin/apachectl-m viewing static and dynamic modules
Inside the share (dynamic) is controlled by the Locadmodule
Static modules plug these static modules into our execution files.
LS/USR/LOCAL/APACHE2/BIN/HTTPD, turning them into a module that can be understood as a kernel module


The last module of the Apache configuration file LoadModule php5_module modules/libphp5.so
It's the top one./configure--with-apxs2=/usr/local/apache2/bin/apxs
The operation done here

====================================
/usr/local/apache2/bin/apachectl-l View only static kernel modules
core.c
http_core.c
mod_so.c


(above is the public mode of APACEH default compilation, 2.0 2.2 default is Prefork mode, 2.4 default is event)


His pattern can be changed.
httpd-2.2.16]#./configure--help |grep MPM
--WITH-MPM=MPM Choose The process model for Apache to use.
MPM={BEOS|EVENT|WORKER|PREFORK|MPMT_OS2}

===================================================
/USR/LOCAL/APACHE2/BIN/APACHECTL-T changed the configuration file, the detection syntax is not error, and then restart =============


Vim/usr/local/apache2/conf/httpd.conf
Found it
<directory/>
Change the deny inside to allow or you won't be able to access
Allow from all

</Directory>

Open this place.
DocumentRoot "/usr/local/apache2/htdocs"

Found it:
#ServerName www.example.com:80
Open it
ServerName localhost:80

Found it:
AddType application/x-gzip. gz. tgz
Under this line, add the following:
AddType application/x-httpd-php. php


Found it:
<ifmodule dir_module>
DirectoryIndex index.html
</IfModule>

Change the line to read:
<ifmodule dir_module>
DirectoryIndex index.html index.php shows the default home page
</IfModule>


/usr/local/apache2/bin/apachectl-t, check it out.


/usr/local/apache2/bin/apachectl Restart Restart apache================

/usr/local/apache2/bin/apachectl Graceful Load configuration file, this can also

5. Test parsing PHP
Direct access to 192.168.11.190
vim/usr/local/apache2/htdocs/1.php This path is where PHP files are placed ============
Write:

<?php
echo "Hello world! ";
?>

After saving, continue testing:
192.168.11.190/1.php

or curl-x192.168.3.129:80 lshfoids.com/1.php or index.html.

<?php

Phpinfo (); Look at the PHP configuration file
?>


Load his config file.
Ls/usr/local/php/etc
cd/usr/local/src/php-5.3.28
Ls
Php.ini-production Copy this file

CP Php.ini-production/usr/local/php/etc/php.ini

/usr/local/apache2/bin/apachectl restart reboot, and then you can show it.

================

Sometimes there is no Web page, how to check and test PHP through the command line
cd/usr/loacl/php/
/usr/local/php/bin/php-m can list all of his loaded modules

In fact, Apache is using this file/usr/local/apache2/modules/libphp5.so =/usr/local/php/bin/php
Libphp5.so is the Apache called module,/bin/php is an executable file, in fact they are a thing, can achieve the same function


/usr/local/php/bin/php-i |less equivalent to Phpinfo () and he saw the same,
If you enter under the bin, direct./bin/php-i |less

Search for PHP configuration files
/usr/local/php/bin/php-i |grep-i ' Configuration File ' check his path.
If you have a hint, just change his time.
Vim/usr/local/php/etc/php.ini
Date.timezone = ' asia/chongqing '


/usr/local/php/etc/php.ini PHP configuration file =========

/usr/local/php/bin/php-v, look at his version.


View the./configure when you have the option to view PHP's
./bin/php-i |head


View Apache-Compiled options
Cat/usr/local/apache2/build/config.nice

MySQL Compilation parameters:
# Cat/usr/local/mysql/bin/mysqlbug|grep Configure


LDD is to query which libraries this file depends on
Ldd/usr/local/apache2/modules/libphp5.so


============== viewing Nginx,apache,php,mysql's compilation parameters

Nginx Compile Parameters:
#/usr/local/nginx/sbin/nginx-v
2, Apache compilation parameters:
# Cat/usr/local/apache/build/config.nice
3, PHP compilation parameters:
#/usr/local/php/bin/php-i |grep Configure
4. mysql Compilation parameters:
# Cat/usr/local/mysql/bin/mysqlbug|grep Configure

The first part installs the mysql-apache-php

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.