In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "linux how to install php and test" related knowledge, editor through the actual case to show you the operation process, the method of operation is simple and fast, practical, I hope that this "linux how to install php and test" article can help you solve the problem.
Linux install php and test methods: 1, install Apache and MySql;2, install PHP;3 through "yum install php", and create test programs for testing.
Operating environment: Red Hat 4.8.2-16 system, php5.3.29 version, DELL G3 computer
How does linux install php and test it?
Building PHP running Environment with linux
I wrote hello world under windows before, but it is not enough after all, because the development environment is Linux, what to do? ~ ~ learn and then learn
I extracted it from an article in Baidu Library, the original title of which is "install Apache+PHP+MySql under Linux to build PHP runtime environment"
Http://wenku.baidu.com/link?url=7A49L1QOIznRoJVz7fC6qaHGiCHTYacwYTLZJEIT_E7URXqgoftdsZdl0tLfKn2n_Tb8PPZ4LqYsA_F1xn5jBovPIR-aG7qUVmPPx34Ft9a
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 apacherpm-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
Sudo systemctl start httpd.service remarks: you can use / etc/init.d/httpd status/stop/start/restart to view status / stop / start / restart respectively, or you can use the service httpd status/stop/start/restart command, with the same effect.
Enter the server IP in the windows browser and view the page. The following indicates that apache is installed successfully.
Second, install MySql
1 check, delete, install
Rpm-qa | grep-I mysql / / check whether to install the mysqlrpm-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, you can install it directly using yum install. I haven't encountered it here.
2 configuration, startup
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// installs php// installation components and supports mysqlyum 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 libmcrypt
2 configuration, 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
That's all for "how linux installs and tests php". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.