In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to compile and install ubantu php7, I believe that 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!
Ubuntu compilation and installation of php7 methods: 1, download the PHP7.4 source code to Ubuntu; 2, install PHP needs to rely on; 3, configure PHP installation parameters; 4, through the "sudo make install" implementation of compilation and installation can be.
Operating environment: Ubuntu 18.04system, PHP7.4 version, DELL G3 computer
Installation environment: operating system: Ubuntu 18.04PHP version: PHP 7.4Web server: Nginx 1.17.4
How does ubantu compile and install php7?
Ubuntu compilation and installation of PHP7.4
Database: Mariadb 10.0.38 (a branch of MySQL, compatible with MySQL)
Before installation
Update the software list according to convention:
Sudo apt-get update
Install PHP7.4
Download the source code for PHP 7.4 to Ubuntu:
`wget https://www.php.net/distributions/php-7.4.0.tar.gz`
If the download speed is too slow, you can use the PHP 7.4 domestic high-speed download address:
Wget https://gz-1257226027.cos.ap-guangzhou.myqcloud.com/php-7.4.0.tar.gz
Extract and enter the php7.4 source code directory:
Tar zxvf php-7.4.0.tar.gzcd php-7.4.0/
Install the dependencies required by PHP first
Sudo apt-get install libzip-dev bison autoconf build-essential pkg-config git-core\ libltdl-dev libbz2-dev libxml2-dev libxslt1-dev libssl-dev libicu-dev libpspell-dev\ libenchant-dev libmcrypt-dev libpng-dev libjpeg8-dev libfreetype6-dev libmysqlclient-dev\ libreadline-dev libcurl4-openssl-dev librecode-dev libsqlite3-dev libonig-dev
Configure PHP installation parameters
/ configure-- prefix=/usr/local/php7-- with-config-file-scan-dir=/usr/local/php7/etc/php.d-- with-config-file-path=/usr/local/php7/etc-- enable-mbstring-- enable-zip-- enable-bcmath-- enable-pcntl-- enable-ftp-- enable-xml-- enable-shmop-- enable-soap-- enable-intl-- with-openssl-- enable-exif-- enable-calendar-- enable-sysvmsg-- enable -sysvsem-- enable-sysvshm-- enable-opcache-- enable-fpm-- enable-session-- enable-sockets-- enable-wddx-- with-curl-- with-iconv-- with-gd-- with-jpeg-dir=/usr-- with-png-dir=/usr-- with-zlib-dir=/usr-- with-freetype-dir=/usr-- enable-gd-jis-conv-with-openssl-- with-pdo-mysql=mysqlnd-- with-gettext=/usr-- with- Zlib=/usr-with-bz2=/usr-with-recode=/usr-with-xmlrpc-with-mysqli=mysqlnd
Perform compilation and installation
Sudo make install
If you are prompted to run out of memory during compilation:
Virtual memory exhausted: Cannot allocate memoryMakefile:921: recipe for target 'ext/fileinfo/libmagic/apprentice.lo' failedmake: * * [ext/fileinfo/libmagic/apprentice.lo] Error 1
Please add virtual memory to the server first. Refer to: add virtual memory Swap for Linux.
Copy Profil
Sudo cp / usr/local/php7/etc/php-fpm.conf.default / usr/local/php7/etc/php-fpm.confsudo cp / usr/local/php7/etc/php-fpm.d/www.conf.default / usr/local/php7/etc/php-fpm.d/www.confsudo cp php.ini-production / usr/local/php7/etc/php.ini
Add environment variables, edit / etc/profile, and add a line at the end of the file:
PATH=/usr/local/php7/bin:/usr/local/php7/sbin:$PATH
To make the environment variable effective:
Source / etc/profile
Add php to the sudo environment variable, edit the Defaults secure_path in the / etc/sudoers file, followed by the PHP path:
/ usr/local/php7/bin:/usr/local/php7/sbin:
Start php-fpm
Sudo php-fpm
If prompted that the gid for the user group nobody cannot be found:
[15-Nov-2019 15:53:49] ERROR: [pool www] cannot get gid for group 'nobody' [15-Nov-2019 15:53:49] ERROR: FPM initialization failed
First, create a nobody user group:
Sudo groupadd nobody
Re-execute the sudo php-fpm to start.
Use the php-v command to view the php version:
Php-vPHP 7.4.0 (cli) (built: Nov 28 2019 13:38:00) (NTS) Copyright (c) The PHP GroupZend Engine v3.4.0, Copyright (c) Zend Technologies above is all the content of this article "how to compile and install php7 in ubantu". 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!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.