Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure PHP Environment in Linux system

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Linux system how to configure the PHP environment, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

About PHP: PHP ("PHP: Hypertext Preprocessor", the acronym for hypertext preprocessor) is a widely used open source multi-purpose scripting language that can be embedded in HTML, especially for web development.

One of the benefits of using PHP is that it is extremely simple for beginners and provides professional programmers with a variety of advanced features. Don't be afraid when you see PHP's long list of features. You can get started quickly, and you can write some simple scripts in just a few hours.

PHP environment configuration steps: installation environment: Red Hat 4.8.2-16

Required installation software:

Apache

PHP

Mysql-server

One installation of Apache

1 check, delete, install

Rpm-qa | grep httpd / / check whether to install apache rpm-e package name-nodeps / / delete PS: I didn't delete it, just use the original server. Yum install httpd / / install, according to the prompt, enter Y to install successfully

2 start, test

/ etc/init.d/httpd start Note: you can use / etc/init.d/httpd status/stop/start/restart to view the status / stop / start / restart respectively, or you can use the service httpd status/stop/start/restart command to enter the server IP in the windows browser and view the page. The following indicates that the apache is installed successfully.

Second, install MySql

1 check, delete, install

Rpm-qa | grep-I mysql / / check whether to install the mysql rpm-e package name-nodeps / / delete it, and there are also some libraries and header files that I don't have on my side. After installation, I can't find the path he said. Yum install mysql mysql-server / / installation, according to the prompts, enter Y to install successfully. If there is a prompt for lack of dependency, just use yum install to install it. I didn't encounter 2 configuration and startup here.

Copy the file: cp-f / usr/share/mysql/my-medium.cnf / etc/my.cnf (overwrite)

Set password: mysql secure installation (enter Y according to the prompt, enter the password twice, enter enter. Thanks for using MYSQL appears! Indicates success)

Remote access:

Mysql-uroot-proot / /-u is followed by a user name, and-p is followed by a password use mysql; select Host,User from user; update user set Host='%' where User='root'; / / ignore flush privileges; select Host,User from user if there is an error

Starting mysql:/etc/init.d/mysqld start / / service mysqld start has the same effect

Third, install PHP

1 installation

Yum install php / / install php / / install components, support mysql yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt2 configuration and startup

The original article wrote a lot of configuration, I do not know what to do, for the time being did not change in accordance with his

Startup: restart httpd mysqld

After writing the php program or modifying the program, execute the command service php-fpm reload to reload

Four tests

1 test program

Index.php

Index1.php

2 put it in the root directory of php

And execute service php-fpm reload

You can also configure it yourself: cat / etc/httpd/conf/httpd.conf (DocumentRoot "/ var/www/html/")

You can also modify the file path such as / var/www/html/test/index.php.

The corresponding access url is ip/test/index.php.

3 visit ip/index.php ip/index1.php on the browser page, as shown in the following page

Thank you for reading this article carefully. I hope the article "how to configure the PHP environment in Linux system" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report