In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to install php and nginx". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to install php and nginx".
i. Install PHP1. Download wget-c http://cn2.php.net/distributions/php-5.6.27.tar.bz2
The following versions are not recommended
Wget-c http://cn2.php.net/distributions/php-7.0.12.tar.bz22. Decompress tar-jxvf php-x.x.x.tar.bz23. Configure cd.. / php-x.x.x
Memory must be greater than 1G, otherwise compilation error
Add the option:-- disable-fileinfo to. / configure to solve the problem.
Sockets extension (optional)
Add-- enable-sockets in. / configure
. / configure-- enable-fpm-- enable-sockets-- disable-fileinfo
An error occurred:
Error: xml2-config not found. Please check your libxml2 installation
Execute the following command:
Sudo apt-get install libxml2-dev
Regenerate makefile
. / configure-- enable-fpm4. Compile make5. Install sudo make install6. Configuration
Create a configuration file and copy it to the correct location.
Sudo cp php.ini-development / usr/local/php/php.inisudo cp / usr/local/etc/php-fpm.conf.default / usr/local/etc/php-fpm.confsudo cp sapi/fpm/php-fpm / usr/local/bin
Set the configuration item cgi.fix_pathinfo in the php.ini file to 0. Open php.ini:
Sudo nano / usr/local/php/php.ini
Navigate to cgi.fix_pathinfo= and modify it as follows:
Cgi.fix_pathinfo=0
The sockets extension needs to modify the following (optional)
# extension_dir = "/ usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"
(no extension path is required for php5.4 version or above) (optional)
Extension=sockets.so
Before starting the service, you need to modify the php-fpm.conf configuration file to ensure that the php-fpm module runs as the www-data user and the www-data user group.
Sudo nano / usr/local/etc/php-fpm.conf
Locate and modify the following:
; Unix user/group of processes; Note: The user is mandatory. If the group is not set, the default user's group; will be used.user = www-datagroup = www-data7. Then start the php-fpm service: / usr/local/bin/php-fpm8. Php boot up
Modify rc.local
Sudo nano / etc/rc.local
Add before the line exit 0
Sudo php-fpm &
If your command takes a long time to run (such as an endless loop) or cannot exit after running, you must make sure that you add a "&" symbol at the end of the command to make the command run in another process.
II. Nginx installation 1. Nginx installation sudo apt-get install-y nginx2. Modify the home page and php configuration sudo nano / etc/nginx/sites-available/default
Modify the web directory to change root to the following
Root / home/pi/www
Find the index line and add index.php. The modified content is as follows
Index index.php index.html index.htm
Find the definition segment of php and remove the comments from these lines. The modified content is as follows
Location. Php$ {fastcgi_index index.php; fastcgi_pass 127.0.0.1 fastcgi_index index.php; fastcgi_pass 9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name;} 3. Restart nginxsudo nginx-s stopsudo nginx4. Create a test page sudo nano / home/pi/www/index.php
Input content
Save
5. Open the browser, enter 127.0.0.1 to view the results thank you for reading, the above is the "how to install php and nginx" content, after the study of this article, I believe you have a deeper understanding of how to install php and nginx this problem, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.