Install Apache2.4 + PHP5.6 + MySQL5.5 (LAMP) in CentOS 6.5)
I always think that the best PHP framework in China is ThinkPHP, but some friends say that the Where condition will be lost in the case of DB updates, it means that when conditional updates are made, all updates may suddenly occur ,. Only the YII framework, which is currently the most popular, can be switched.
After the basic framework is Down, run it and check the tutorial documentation to find that the minimum PHP5.4 version is required, but the php5.3 version is used in the system, it seems that the upgrade is coming.
I am not sure why php has updated so many versions, but the default yum version of CentOS is PHP5.3. I cannot find a method to Upgrade PHP directly, only manual compilation and upgrade are supported.
First, let's talk about the idea, because at first the system ran a complete PHP environment, and at that time it was quickly and automatically installed. If you ran some versions earlier than 5.3, it would be very simple, just a few instructions, it takes 10 minutes.
But now we need to upgrade it. If it's a little more thorough, We have to reinvent it. The steps are as follows:
1. Uninstall Apache, php, and mysql;
2. Clear some remaining configuration files;
3. install Apache, mysql, and php step by step. Of course, you must pay attention to the dependency controls of each software during the process.
The steps below are as follows ):
1. To do this, you must first sharpen the tool. The installation packages of each software are required, including:
- Apr-1.5.1.tar.bz2
- Apr-util-1.5.4.tar.bz2
- Pcre-8.36.tar.bz2
- Httpd-2.4.10.tar.bz2
- Mysql-5.5.21.tar.gz
- Php-5.6.4.tar.bz2
You can search and download the specific version.
2. Install Apache2.4
- Apr-1.5.1.tar.bz2
- Apr-util-1.5.4.tar.bz2
- Pcre-8.36.tar.bz2
These are some installation packages on which Apache depends, which can be decompressed and installed.
Cd apr-1.5.1
./Configure -- prefix =/usr/local/apr
Make & make install
Cd apr-util-1.5.4
./Configure -- prefix =/usr/local/apr-util -- with-apr =/usr/local/apr
Make & make install
Cd pcre-8.36
./Configure
Make & make install
Install Apache
Cd httpd-2.4.10
. /Configure -- prefix =/usr/local/apache2 -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util --- pcre =/usr/local/pcre -- enable-so -- enable-rewrite
Make & make install
Cp/usr/local/apache2/bin/apachectl/etc/rc. d/init. d/httpd
Service httpd start
Test whether the installation is successful
If "It works" is displayed, It means that Apache has been installed properly.
2. Install Mysql
Install cmake first
Yum-y install cmake make
Cd mysql-5.5.21
Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/usr/local/mysql/data-DSYSCONFIGDIR =/usr/local/mysql/etc-DWITH_INNOBASE_STORAGE_ENGINE = 1-Hangzhou = 1 -DWITH_BLACKHOLE_STORAGE_ENGINE = 1-DWITH_PARTITION_STORAGE_ENGINE = 1-DMYSQL_UNIX_ADDR =/tmp/mysqld. sock-DMYSQL_TCP_PORT = 3306-DENABLED_LOCAL_INFILE = 1-DEXTRA_CHARSETS = all-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DMYSQL_USER = mysql
Make & make install
Configure mysql 5.5.21
Cp/usr/loacl/mysql/support-files/my-huge.cnf etc/my. cnf
Vi/etc/my. cnf
Modify the configuration of my. cnf and remove the # In front of innodb related options, which is roughly between 115-130.
Run the following command to configure mysql startup and Automatic startup:
Cp/usr/loacl/mysql/support-files/mysql. server/etc/init. d/mysqld
/Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data &
Chkconfig -- add mysqld
Chkconfig -- level 345 mysqld on
Service mysqld start
Generally, no error is reported if I set my. cnf.
The remaining mysql account, password, database, and other changes will remain the same.
3. Install PHP5.6
Cd php-5.6.4
. /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-libxml-dir =/usr/include/libxml2 --- config-file-path =/usr/local/apache2/conf -- with-mysql =/usr/local/mysql -- with-mysqli =/usr/local/mysql/bin/mysql_config -- with-gd -- enable-gd-native-ttf -- with-zlib -- with-mcrypt -- with-pdo-mysql =/usr/local/mysql -- enable-shmop -- enable- soap -- enable-sockets -- enable-wddx -- enable-zip -- with-xmlrpc -- enable-fpm -- enable-mbstring -- with-zlib-dir -- with-bz2 -- with-curl -- enable- exif -- enable-ftp -- with-jpeg-dir =/usr/lib -- with-png-dir =/usr/lib -- with-freetype-dir =/usr/lib/
Sometimes, CentOS reports the error "mcrypt. h not found. Please reinstall libmcrypt" during compilation.
This is a good solution. See
After solution
Make & make install
Apache configuration file httpd. conf to support PHP
Vim/usr/local/apache/conf/httpd. conf
1. Add php support.
AddType application/x-httpd-php. php. phtml
AddType application/x-httpd-php-source. phps
2. Click "index. php" next to "index. php" on the index page"
DirectoryIndex index.html index. php
3. If the directory structure is not displayed, find "Options Indexes FollowSymLinks" and change it
Options FollowSymLinks
4. Enable Apache to support pseudo-static state. Find "AllowOverride None" and change it
AllowOverride All
Save the httpd. conf configuration, and then execute the following two lines
Chown-R nobody./usr/local/apache/htdocs/
Chmod-R 777/usr/local/apache/htdocs/
Service httpd restart
Here, the basic PHP environment is ready. Let's test it.
Check whether YII2 works properly.
Bingo ~~~ Close.
Install Xcache and Memcached on the LAMP platform to accelerate website operation
Build a LAMP platform environment in CentOS 7
CentOS 6.5 system installation and configuration LAMP (Apache + PHP5 + MySQL) server environment
Configure the LAMP + phpMyAdmin PHP (5.5.9) development environment in Ubuntu 14.04
Install LAMP in Ubuntu 14.10