In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
What should I do to configure apache and php on mac? Many people don't know much about it. Today, in order to let you know more about the method of configuring apache and php on mac, I summarized the following contents. Let's read on.
In the Mac environment, the system itself comes with Apache (Apache Server) and PHP are pre-installed. Let's take a step-by-step approach to the merge of Apache and PHP:
Step 1: check the pre-installed Apache and PHP versions of the system
(1) Open the terminal and enter the command: sudo apachectl-version
(2) enter the command: sudo php-v
Step 2: modify the Apache configuration file
(1) go to Finder (general shortcut key is: command+shift+G), and enter address: / private/etc/apache2
(2) find the file named httpd.conf and select TextEdit to open it. Because this file is locked, it is not allowed to be modified. So, we can copy it to the desktop, delete the original file after modification, and then move the modified file to the location of the original file)
(3) after opening it, use the search keyword "php" (general shortcut key is command+F), and the search result is as shown in the figure:
(4) delete the "#" sign at the front of this line of text, delete it, save it, close the document, and replace the original document with it.
Step 3: generate PHP configuration file
(1) go to Finder, (the general shortcut key is: command+shift+G), enter the address: / private/etc, just go to the etc directory and find a file named php.ini.default in this directory. Copy this file, still copy it to the current directory, and then rename the newly copied file to php.ini. Note: only change the file name, the content does not need to be modified. After modification, as shown in the figure:
Step 4: restart the Apache service
(1) Open the terminal and enter the command: sudo apachectl restart
(when you open the http://localhost: page, you will see it works!)
Step 5: test and run the PHP file
(1) go to Finder, (the general shortcut key is: command+shift+G), and enter the address: / Library/WebServer (it should be emphasized that this folder is the root path folder of the server, and we do not have read and write permissions by default, so we need to enable read and write permissions, which is also convenient for future development tools to read and write files here.) The specific operation steps are shown in the figure:
Show introduction:
Click the mini lock in the lower right corner-> enter the password
(2) under the Documents folder (again, this is the root path of the server! Create a file named index.php (any name, for testing), write the following php code in it, and save it:
(3) Open a browser to access the file we just created, and enter: http://localhost/index.php, as shown in the figure in the address bar, then you will succeed:
Done!
The above is a brief introduction of how to configure apache and php on mac. Of course, the differences in the detailed use of the above have to be understood by everyone. If you want to know more, welcome to follow the industry information channel!
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.