Build a CENTOS7 PHP environment

Source: Internet
Author: User
Tags learn php php and mysql phpinfo

Today due to the need, however start to learn PHP, and configure the development of PHP. It's simple, but it's a record.

Development environment:

Virtual Machine Workstation Pro

System Centos7

Database MySQL 5.6

Then based on this tutorial (Linux PHP Environment Setup)

Https://jingyan.baidu.com/article/3d69c5518e82e3f0cf02d7ea.html

I thought it was so simple, but because my centos virtual machine does not have a browser, so I can not see the corresponding effect, so I access the virtual machine in the native PHP project,

Then there are a variety of problems.

I created the phpinfo.php file under/var/www/html and then accessed the Apache server in the virtual machine (httpd),

192.168.1.11/phpinfo.php However, no PHP information appears.

Start by stating that you are having trouble accessing the site.

Tried out is not 80 port is occupied

[[email protected] HTML]# NETSTAT-ANP | grep 80 | grep LISTEN

Discover that listening on port 80 is only httpd, which is not occupied by other applications.

Continue to find the question, whether there is open 80 port

[Email protected] html]# netstat-tln

It is also not the case that 80 ports are open to the outside.

Then continue to find the PHP configuration problem, httpd.conf file

[Email protected] html]# vim/etc/httpd/conf/httpd.conf

There are many configurations in this file, the following is the situation in my configuration, but I found that there are different on the Internet,

You can also refer to http://www.cnblogs.com/diony/p/4741237.html

First place

Options FollowSymLinks
AllowOverride None
Require all granted

Modified to:

Options FollowSymLinks
AllowOverride None
Order Deny,allow
Allow from all

Once this is configured, restart the Apache service (httpd service).

Service httpd Restart

Or

Apachectl Restart (mine is this command, the above command does not know why not, possibly the corresponding file)

The problem continues, and the configuration is all right. The problem with SELinux is that I'm getting a glimpse of it.

The problem is this: SELinux is preventing/usr/sbin/networkmanager from read access on the file network.

Then I checked, online all kinds of experts, one of the simplest way to prohibit selinux. (You are interested to have a look.)

And then
[Email protected] html]# Restorecon

After the ban, use the following to see that it is not disable
[Email protected] html]# sestatus-v

It was found that there is no prohibition, restart the reboot.

Go ahead and find out that it's already disable, and then you can access it. Ha ha! ~

Until now everything is normal, then try to test the database can not access, if found not you can see is not 3306 port is occupied, method with 80 port.

After the internet casually find a PHP and MySQL connection to the small demo will know. I've done it!

Finally thank you online big God Daniel's tutorial, although the younger brother is the first contact with PHP, but also the first build, but because the internet has sound information,

So that I can build a good PHP environment in a short time, I will also pass this small experience to more beginners!

Build a PHP environment for CENTOS7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.