Apache Server
- Start up Apache on Mac
- sudo apachectl (-k) start
- //sudo apachectl (-k) restart
- sudo apachectl (-k) stop
- Check the apache version
- sudo apachectl -v
- or apachectl -v
- (Mac) Apache: You don’t have permission to access / on this server
1
2
3
4
5<Directory "/Users/andy/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
Configure PHP Server
Search httpd.conf
1
2
3cd /etc/apache2
//sudo cp httpd.conf httpd.conf.bak
sudo vim httpd.confConfigure httpd.conf
1
2
3
4// Change the DocumentRoot "/Library/WebServer/Documents"
DocumentRoot "/Users/andy/Sites"
// Change the <Directory "/Library/WebServer/Documents">
<Directory "/Users/andy/Sites">Find php
1
2#LoadModule php5_module libexec/apache2/libphp5.so
drop "#"cd /etc/
1
sudo cp php.ini.default php.ini
Create index.php in /Users/andy/Sites”, and type in
1
<?php phpinfo(); ?> // <?php without blank space
sudo apachectl restart
- Scan localhost in website
1
http://loaclhost/index.php