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 mac installs php environment variable configuration

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

Share

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

Mac how to install php environment variable configuration, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

Mac install php environment method: 1, open the terminal, enter "$sudo apachectl start" to start Apache;2, copy the "index.html.en" file in the root directory of Apache and rename it to info.php;3, install MySql and test the environment.

This article operating environment: macOS10.12.5 system, PHP5.6, macbook pro 2020 computer.

How does mac install php environment variable configuration?

Mac Quick configuration of PHP runtime environment

Catalogue

Start Apache (Mac has built-in Apache service, just start Apache directly)

Run PHP (popular talk about the relationship between Apache and PHP)

Configure MySql

Use phpMyAdmin (phpMyAdmin is a program developed with PHP to manage MySql)

Start Apache

1. Open the terminal and enter

$sudo apachectl start

2. At this time, you will be prompted to enter the password, enter the computer password, and then you can view the Apache version number and enter it.

$sudo apachectl-v

3. The version information of Apache will be displayed.

Server version: Apache/2.4.25 (Unix) Server built: Feb 6 2017 20:02:10

At this point, type http://localhost in the browser and It works will appear! That indicates that Apache has been started

Finally, additional Apache commands are attached:

$sudo apachectl stop # shut down the Apache service $sudo apachectl restart # restart the Apache service

Note: Apache HTTP Server (abbreviated as Apache) is a web server software that can run on almost all widely used computer platforms. Because of its cross-platform and security, it is one of the most popular Web server-side software.

Run PHP

1. Under the directory / etc/apache2/, find the configuration file httpd.conf file for Apache, and open it using document editing.

# Terminal commands quickly enter the file directory / etc/apache2/$ open / etc/apache2/

2. Click the Command+F shortcut key in the document to search.

# LoadModule php5_module libexec/apache2/libphp5.so

3. Delete the previous annotation symbol #.

4. Restart Apache and type in the terminal.

$sudo apachectl restart

5. Copy the index.html.en file in the root directory of Apache and rename it to info.php

Sudo cp / Library/WebServer/Documents/index.html.en / Library/WebServer/Documents/info.php

6. Open info.php

Add code

It works!

Then restart Apache again

$sudo apachectl restart

Finally, enter it in the browser

Http://localhost/info.php

A page showing the php message appears, indicating that PHP is ready for use

Page of php information

Configure MySql

1. Download and install MySql, and double-click to install

MySql

2. Note that a prompt will pop up when the installation is successful. MySql has assigned a random password to your account root. Write down this password or take a screenshot, which will be used later.

The password that prompts me when the installation is successful is

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