CentOS7 + Apache2.4 + Mysql5.5 + PHP5.5

Source: Internet
Author: User

CentOS7 + Apache2.4 + Mysql5.5 + PHP5.5

Mysql: http://dev.mysql.com/downloads/mysql/

My version: MySQL-5.6.24-1.linux_glibc2.5.x86_64.rpm-bundle.tar

Apache: http://apache.mirrors.lucidnetworks.net/httpd/

My version: httpd-2.4.12.tar.gz

Apache Protable Runtime (APR) (of course, the APR dependency package also needs to be in this connection): http://apache.osuosl.org//apr/

My version:

Apr-1.5.2.tar.gz

Apr-util-1.5.4.tar.gz

Pcre-8.37.tar.gzftp: // ftp. csx. cam. ac. uk/pub/software/programming/pcre/

Install pcre. Do not download pcre2. Otherwise, you need to change the name or configuration. It is troublesome to change many items, and some people do not install it. However, I suggest installing it. Regular Expression, I chose to install it.

Php: http://php.net/downloads.php

My version: php-5.5.25.tar.gz

Configure xml components libxml2: Official ftp://xmlsoft.org/libxml2/

In addition, my CentOS7 has been updated.

Before installation:

Install gcc & gcc-c ++ and use apache later. Simply install it first.

yuminstall-ygccgcc-c++

This section describes the hardware environment and the files to be installed. The installation is as follows:

Install MySql

Before installation, you must provide an explanation. The following is an official warning:

Warning
Once the release package is installed on your system, any system-wide update by the yum update command will automatically upgrade MySQL packages on your system and also replace any native third-party packages, if Yum finds replacements for them in the MySQL Yum repository. seeUpgrading MySQL with the MySQL Yum RepositoryandReplacing a Native Third-Party Distribution of MySQLfor details.

This means that after installing this version package, you only need to useThe Yum update command updates the system. MySqL is automatically updated to the latest version, including replacing some third-party Packages. However, two connections are provided to help us update Mysql and update the third-party Package.

#rpm-ivhMySQL-devel-5.6.24-1.linux_glibc2.5.x86_64.rpm#rpm-ivhMySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm#rpm-ivhMySQL-client-5.6.24-1.linux_glibc2.5.x86_64.rpm

View the version information after installation:

#mysql--versionmysqlVer14.14Distrib5.6.24,forLinux(x86_64)usingEditLinewrapper

View the installed mariadb information:

#yumlist*maria*mariadb.x86_641:5.5.41-2.el7_0@basemariadb-libs.x86_641:5.5.41-2.el7_0@basemariadb-server.x86_641:5.5.41-2.el7_0@base

Let's try:

#mysqlERROR2002(HY000):Can'tconnecttolocalMySQLserverthroughsocket'/var/lib/mysql/mysql.sock'(2)

Okay, forget to start the service to start our mariadb service.

#systemctlstartmariadb.service# Systemctlenablemariadb. service # Set mariadb to automatically start when the mariadb service starts normally.

Then perform security settings for mariadb:

#sudomysql_secure_installation/usr/mysql_secure_installation:line379:find_mysql_client:commandnotfoundNOTE:RUNNINGALLPARTSOFTHISSCRIPTISRECOMMENDEDFORALLMariaDBSERVERSINPRODUCTIONUSE!PLEASEREADEACHSTEPCAREFULLY!InordertologintoMariaDBtosecureit,we'llneedthecurrentpasswordfortherootuser.Ifyou'vejustinstalledMariaDB,andyouhaven'tsettherootpasswordyet,thepasswordwillbeblank,soyoushouldjustpressenterhere.Entercurrentpasswordforroot(enterfornone):ERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:NO)Entercurrentpasswordforroot(enterfornone):OK,successfullyusedpassword,movingon...SettingtherootpasswordensuresthatnobodycanlogintotheMariaDBrootuserwithouttheproperauthorisation.Youalreadyhavearootpasswordset,soyoucansafelyanswer'n'.Changetherootpassword?[Y/n]n...skipping.Bydefault,aMariaDBinstallationhasananonymoususer,allowinganyonetologintoMariaDBwithouthavingtohaveauseraccountcreatedforthem.Thisisintendedonlyfortesting,andtomaketheinstallationgoabitsmoother.Youshouldremovethembeforemovingintoaproductionenvironment.Removeanonymoususers?[Y/n]y...Success!Normally,rootshouldonlybeallowedtoconnectfrom'localhost'.Thisensuresthatsomeonecannotguessattherootpasswordfromthenetwork.Disallowrootloginremotely?[Y/n]Y...Success!Bydefault,MariaDBcomeswithadatabasenamed'test'thatanyonecanaccess.Thisisalsointendedonlyfortesting,andshouldberemovedbeforemovingintoaproductionenvironment.Removetestdatabaseandaccesstoit?[Y/n]Y-Droppingtestdatabase......Success!-Removingprivilegesontestdatabase......Success!Reloadingtheprivilegetableswillensurethatallchangesmadesofarwilltakeeffectimmediately.Reloadprivilegetablesnow?[Y/n]YERROR1146(42S02)atline1:Table'mysql.servers'doesn'texist...Failed!Cleaningup...Alldone!Ifyou'vecompletedalloftheabovesteps,yourMariaDBinstallationshouldnowbesecure.ThanksforusingMariaDB!

The specific settings are for your reference only.

Now let's hurry in and try it:

#mysql-uroot-pEnterpassword:WelcometotheMariaDBmonitor.Commandsendwith;or\g.YourMariaDBconnectionidis24Serverversion:5.5.41-MariaDBMariaDBServerCopyright(c)2000,2014,Oracle,MariaDBCorporationAbandothers.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.MariaDB[(none)]>

OK, mysql installation is complete,

In addition, you must note that adding your system to firewall is on. Please note that port 3306 is open for mysql.

The first step is complete.

Install our fighter(Apache)#gzip-dhttpd-2.4.12.tar.gz#tarxvfhttpd-2.4.12.tar#cdhttpd-2.4.12

Start compilation and installation:

#./configure--prefix=/usr/local/apachecheckingforchosenlayout...Apachecheckingforworkingmkdir-p...yescheckingforgrepthathandleslonglinesand-e.../usr/bin/grepcheckingforegrep.../usr/bin/grep-Echeckingbuildsystemtype...x86_64-unknown-linux-gnucheckinghostsystemtype...x86_64-unknown-linux-gnucheckingtargetsystemtype...x86_64-unknown-linux-gnuconfigure:configure:ConfiguringApachePortableRuntimelibrary...configure:checkingforAPR...noconfigure:error:APRnotfound.Pleasereadthedocumentation.

If APR is missing, install an APR instance (You have downloaded it at the beginning of the article, and install it directly ):

Install APR:

#mkdir/usr/local/apr#tar-zxvfapr-1.5.2.tar.gz#cdapr-1.5.2#./configure--prefix=/usr/local/aprbalabala......#make#makeinstall

OK, then Apr-util:

#tar-zxvfapr-util.1.5.4.tar.gz#cdapr-util#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-1-config#make#makeinstall

Below is PRCE:

#mkdir/usr/local/pcre#tar-zxvfpcre-8.37.tar.gz#./configure--prefix=/usr/local/pcre--with-apr=/usr/local/apr/bin/apr-1-config#make#makeinstall

Okay, these dependent packages have been installed, and we will try again.

#cdhttpd-2.4.12#./configure--prefix=/usr/local/apache--with-pcre=/usr/local/pcre--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util#make#makeinstall

Normal completion. Check whether the operation is normal:

Install PHP#tar-zxvfphp-5.5.25.tar.gz#cdphp-5.5.25#mkdir/usr/local/php#./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs--with-config-file-path=/usr/local/lib--enable-track-var--with-xml--with-mysql--with-zlib-dir=/usr/localconfigure:error:xml2-confignotfound.Pleasecheckyourlibxml2installation.

Forgot, our xml component has not been installed yet.

#tar-zxvflibxml2-2.9.2.tar.gz#cdlibxml2-2.9.2#mkdir/usr/local/libxml2#./configure--prefix=/usr/local/libxml2#makelibxml.c:14:20:fatalerror:Python.h:Nosuchfileordirectory#include<Python.h>

Check the Python Package.

#yumsearchpython|greppython-develdbus-python-devel.i686:Librariesandheadersfordbus-pythondbus-python-devel.x86_64:Librariesandheadersfordbus-pythongstreamer-python-devel.i686:Headersfordevelopingprogramsthatwillusegstreamer-python-devel.x86_64:Headersfordevelopingprogramsthatwillusepython-devel.x86_64:ThelibrariesandheaderfilesneededforPython

There are exactly 64-bit ones. Please install the following:

#yuminstallpython-devel.x86_64

Good. Let's install libxml2 again.

#./configure--prefix=/usr/local/libxml2#make#makeinstall

Eight, eight, eight, and so on. Then make:

#./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs--with-config-file-path=/usr/local/lib--enable-track-var--with-xml--with-mysql--with-zlib-dir=/usr/localConfiguringSAPImodulesRunningsystemchecksGeneralsettingsConfiguringextensionsconfigure:error:xml2-confignotfound.Pleasecheckyourlibxml2installation.

Khan, it's faulty again. Let's see if there is anything about libxml that has not been installed and installed (mainly: *-devel ):

#yumlist*libxml*#yuminstalllibxml2-devel.x86_64

Very OK, next to the third time to install PHP, the result is the same as once, so the following attempt to change some commands, please note:

#./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs--with-libxml2=/usr/local/libxml2--with-mysql=/usr/bin/mysqlConfiguringSAPImodulesRunningsystemchecksGeneralsettingsConfiguringextensionsconfigure:error:CannotfindMySQLheaderfilesunder/usr/bin/mysql.NotethattheMySQLclientlibraryisnotbundledanymore!

Check whether mysql is not installed and installed:

#yumlist*mariadb*#yuminstallmariadb-devel.x86_64

It seems that I can't do anything, so I have to zoom in:

#./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs--with-libxml2=/usr/local/libxml2--with-config-file-path=/usr

Good, finished. But does anyone know why they cannot find the specific path?

Let's test it first:

vim/var/www/info.php<?phpphpinfo();?>

Only one blank page is displayed,

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.