How to set up PHP server on Mac OS X 10.8
2012-10-10 16:16
796 查看
In Mac OS X 10.8 version, Apple delete the web sharing function in System Preferences. But this version of operating system has pre-install a version of PHP server.
So at first, we can start PHP service by using command in Terminal.
The terminal doesn't give us any prompt.
But after this step, we can use another command to look up the version of PHP server.
Then we can open the browser and type http://localhost.
we will find a homepage, which default set by PHP server.
If we use "http://localhost" url to access our web server, it means we access to the computer directory, which is /Library/WebServer/Documents. This is called System Web Level Root. But if we want to use the traditional version such as we used in Mac OS
X 10.7 and before, we should change some configuration in this version.
I try to find a mount of resource to do this thing. But nothing worked in my MAC Pro.
At last, I find a APPLESCRIPT to auto change all the configuration aim to get the User Level Root.
Actually, I didn't find any difference between this APPLESCRIPT and my manual configuration.
But only this type of script can work!!!!!!
I don't know why.
At last I will put the resource that I find and follow. But this article didn't give me any help!!
If somebody find the difference between this two methods, please let me know.
Thank you very much.
REFERENCE
So at first, we can start PHP service by using command in Terminal.
sudo apachectl start
The terminal doesn't give us any prompt.
But after this step, we can use another command to look up the version of PHP server.
apachectl -vThe Terminal will give us a prompt.
Server version: Apache/2.2.22 (Unix) Server built: Aug 24 2012 17:16:58
Then we can open the browser and type http://localhost.
we will find a homepage, which default set by PHP server.
If we use "http://localhost" url to access our web server, it means we access to the computer directory, which is /Library/WebServer/Documents. This is called System Web Level Root. But if we want to use the traditional version such as we used in Mac OS
X 10.7 and before, we should change some configuration in this version.
I try to find a mount of resource to do this thing. But nothing worked in my MAC Pro.
At last, I find a APPLESCRIPT to auto change all the configuration aim to get the User Level Root.
set userHome to (short user name of (system info)) set configFile to "/etc/apache2/users/" & userHome & ".conf" set configFileContents to "<Directory \"/Users/" & userHome & "/Sites/\"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory>" do shell script "echo '" & configFileContents & "' > " & configFile with administrator privileges do shell script "/usr/sbin/apachectl restart" with administrator privileges
Actually, I didn't find any difference between this APPLESCRIPT and my manual configuration.
But only this type of script can work!!!!!!
I don't know why.
At last I will put the resource that I find and follow. But this article didn't give me any help!!
If somebody find the difference between this two methods, please let me know.
Thank you very much.
REFERENCE
相关文章推荐
- How to set up native subversion (javahl) with Subclipse on Mac OS X
- How to set up an FTP server on Ubuntu 14.04
- iOS 如何在苹果电脑上安装svn 服务器(how to install svn server on the computer of mac os x)
- How to set up a simple mail server on Debian in 5 easy steps
- How To Fix – Mcrypt PHP extension required in Laravel on Mac OS X (No MAMP)
- How to Set $JAVA_HOME environment variable on Mac OS X
- How to set up an SFTP server on Linux
- How to set up CA server on server 2012
- How to use/install gcc on Mac OS X 10.8 / Xcode 4.4
- How to set up a Subversion (SVN) server on CentOS or Fedora
- How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 14.04 LTS
- Set up NginX and PHP for development on Mac OS X
- How to Install mcrypt for php on Mac OSX Lion 10.8 & 10.7 Development Server
- How to set up a PXE server with REHL 7 OS
- How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu
- [转载]How To Set Up And Use X11 Forwarding On Linux And Mac
- How to set up a mail server on a GNU / Linux system