How to compile and install php-5.5.34
Editor to share with you how to compile and install php-5.5.34, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
To compile and install php-5.5.341 and solve dependencies, first configure Aliyun source: # 1, backup # mv/etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.backup # 2, Download the new CentOS-Base.repo to / etc/yum.repos.d/CentOS 6 etc/yum.repos.d/CentOS # wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repoCentOS 7 etc/yum.repos.d/CentOS # wget-O / etc/yum.repos.d/CentOS-Base.repo # 3, and then run the yummakecache generation cache
Add an Epelfeed:
# 1. Backup (if other epel sources are configured) # mv/etc/yum.repos.d/epel.repo / etc/yum.repos.d/epel.repo.backup# mv/etc/yum.repos.d/epel-testing.repo / etc/yum.repos.d/epel-testing.repo.backup # 2, Download the new repo to / etc/yum.repos.d/epel (RHEL 7): # wget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo epel (RHEL 6): # wget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo installation dependency package: # yum-y groupinstall "DesktopPlatform Development" # yum-y install bzip2-devel libmcrypt-devel libxml2-devel
If you want the compiled php to support mcrypt extensions, you also need to install this dependency package separately here. Epel6 can be installed directly with:
# yum-y install libmcrypt libmcrypt-devel mhash mhash-devel
Note: if you are using the source of epel7, you may not have several packages of mcrypt mhash mhash-devel, which can be downloaded in http://mirrors.aliyun.com/epel/6/x86_64/ and manually installed using yum localinstall xxx.rpm or rpm-Uvh xxx.rpm.
2. Create www user # groupadd-r www# useradd-g www-s / sbin/nologin-M www3, compile and install php-5.5.34
First download the source package to the local directory
[root@webtool] # wget http://cn2.php.net/distributions/php-5.5.34.tar.gz[root@web tool] # tar xf php-5.5.34.tar.gz [root@webtool] # cd php-5.5.34
Then execute the following compilation parameters:
. / configure--prefix=/usr/local/php\-- with-config-file-path=/etc\-- with-config-file-scan-dir=/etc/php.d\-- with-bz2\-- with-curl\-- enable-ftp\-- enable-sockets\-- disable-ipv6\-- with-gd\-- with-jpeg-dir=/usr/local\-with-png-dir=/usr/local\-- with-freetype-dir=/usr/local\-- enable-gd -native-ttf\-- with-iconv-dir=/usr/local\-- enable-mbstring\-- with-mcrypt\-- with-mhash\-- with-openssl\-- enable-bcmath\-- enable-calendar\-- with-gettext\-- with-libxml-dir=/usr/local\-- with-zlib\-- with-pdo-mysql=mysqlnd\-- with-mysqli=mysqlnd\-with-mysql=mysqlnd\-enable-dom\-enable-xml\-- enable-fpm\-- with-fpm -user=www\-with-fpm-group=www\-with-libdir=lib64\-enable-bcmath\-enable-maintainer-zts\
If there is no error, execute the following command to compile and install:
# make# make test# make intall
Please be patient.
# Parameter description: # "installation path"--prefix=/usr/local/php\ #" php.ini configuration file path ""-- with-config-file-path= / etc\ # "Optimization options"-enable-inline-optimization\-- disable-debug\-- disable-rpath\-- enable-shared\ # "" enable opcache Default is ZendOptimizer+ (ZendOpcache) ""-- enable-opcache\ # "FPM"--enable-fpm\-- with-fpm-user=www\-- with-fpm-group=www\ #" MySQL ""-- with-mysql=mysqlnd\-- with-mysqli=mysqlnd\-- with-pdo-mysql=mysqlnd\ # "" internationalization and character encoding support "- with-gettext\-- enable-mbstring\-- with-iconv\ #"image format" Support for ""-- with-freetype-dir\-- with-jpeg-dir\-- with-png-dir\ # "encryption extension"--with-mcrypt\-- with-mhash\-- with-openssl\ #" Mathematical extension ""-- enable-bcmath\ # "Web service" Soap relies on libxml ""-- enable-soap\-- with-libxml-dir\ "" process Signal and memory ""-- enable-pcntl\-- enable-shmop\-- enable-sysvmsg\-- enable-sysvsem\-- enable-sysvshm\ # "socket & curl"-- enable-sockets\-- with-curl\ # "Compression and archiving"-- with-zlib\-- enable-zip\-- with-bz2\ # support the PHP required for the installation of apache's worker or event MPM--enable-maintainer-zts # Zabbix Extension parameters-enable-bcmath--enable-mbstring--enable-sockets--with-gd--with-libxml-dir=/usr/localxmlwriter ditto xmlreader ditto ctype default support session default support gettext default support 4. Provide configuration file for php: [root@web php-5.5.34] # cp php.ini-production/etc/php.ini# description: # php.ini-development / / Development environment # php.ini-production/ / production environment 5. Edit apache configuration file httpd.conf Use apache to support php [root@web php-5.5.34] # vim/etc/httpd24/httpd.conf # enter 409gg to jump directly to line 409 and add the following two items (pay attention to the format, after. ): 409 AddTypeapplication/x-httpd-php .php .phtml410 AddTypeapplication/x-httpd-php-source .phps # skip to 165lines, modify damon to other users such as www165 # running httpd, as with most system services.166 # 168PHP # change the home page, jump to 256lines, add index.php home page: 256257 DirectoryIndexindex.php index.html2586, then restart httpd: [root @ web php-5.5.34] # service httpd restart7, test:
Installation of php programs and mysql:
[root@web php-5.5.34] # cd/usr/local/apache/htdocs [root@web htdocs] # vim index.php
Then the browser enters the ip address:
Indicates that apache mysql php is installed successfully!
The above is all the contents of the article "how to compile and install php-5.5.34". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!