- 1
OS X Default has two directories can run your Web program directly, one is the system-level Web root directory, one is the user-level root directory, everyone write down.
Note: The following haibor are user names and need to be modified in real terms.
The root directory of the Apache system level and the corresponding URL is:
/library/webserver/documents/http://localhost
The User-level root directory and the corresponding URL are:
~/sites http://localhost/~haibor/
~/sites is the "site" directory under your user directory, which may not be in OS X, so you need to manually create a directory with the same name.
is built in a simple way, run directly in the terminal:
sudo mkdir ~/sites
- 2
Set up the Sites folder, check the/etc/folder below for the "haibor.conf" file:
/etc/apache2 /users/
If not, then you need to create one, named "Haibor.conf", which can be created using either VI or Nano, one of the two editors.
sudo vi/etc/apache2/users/haibor.conf
After creation, write the following lines to the Conf file above:
<directory "/users/haibor/sites/";
options Indexes multiviews
allowoverride all
order allow,deny
allow from all
< /directory>
- 3
Once the file is saved, grant it the appropriate permissions:
sudo chmod 755/etc/apache2/users/haibor.conf
Next, restart Apache to make the configuration file effective:
sudo apachectl restart
After that you can access your user-level directory page through a browser, you can easily prevent a webpage to test it. The root directory address is:
http://localhost/~haibor/
You can also change the root directory, but to remember to set the new folder, the folder needs to have Execute permission x, set to 755:
Mkdir/users/user/workspace chmod 755/user/user/workspace
Replace the/library/webserver/documents/in the/etc/apache2/httpd.conf file with your own path, such as/user/user/workspace
Restart Apache:apachectl restart, and then visit localhost again to display the contents of the changed file.
END
Iv. installation of MySQL
- 1
There is no integrated Mysql in OS X Mavericks and requires manual installation.
You can click http://dev.mysql.com/downloads/mysql/to download the MySQL installation package.
Please download Mac OS X 10.7 (x86, 64-bit), DMG Archive (if you have a newer version, downloadable).
After downloading the DMG, double-click you will extract three files and a RedMe.txt document. These three files are:
Mysql-5.6.15-osx10.7-x86_64.pkg
Mysqlstartupitem.pkg
Mysql.prefpane
You need to install each of these three files, mysqlstartupitem.pkg installation, MySQL will start with the system boot, Mysql.prefpane indicates that you can see the MySQL option in System Preferences, there is a MySQL installation.
- 2
After all three files are installed, go to "system Preferences", at the bottom of the panel you will see a MySQL setting, click on it to start MySQL.
You can also turn on MySQL by command:
Sudo/usr/local/mysql/support-files/mysql.server start
If you want to view the MySQL version, you can use the following command:
/usr/local/mysql/bin/mysql-v
After running the above command, you will log in to MySQL directly from the command line and enter the command \q to exit.
Here MySQL is configured to complete and can be run.
- 3
In order to be more convenient to use, it is better to set the system environment variables, that is, the MySQL command in any path can be directly started (do not need to enter a long string of exact path).
Setting environment variables is also very convenient, directly with the command (here I use VI editor example):
cd; VI. bash_profile
Then press the letter I into the edit mode, the following code is pasted into the sentence:
Export path= "/usr/local/mysql/bin: $PATH"
Then press ESC to exit the editor, and then enter: Wq (don't forget the colon) to save the exit. Of course, if you use the Nano or other editor, the operation may not be the same as this, anyway, it means to write the above sentence into the. bash_profile file.
The next step is to reload the Shell to make the above environment variable effective:
SOURCE ~/.bash_profile
After that you can use the MySQL command in any directory of the terminal, you can run mysql-v to try.
- 4
The last step, after installing the default username is root, password is empty, you should also give your MySQL set a root user password, the command is as follows:
mysqladmin-u root password ' here to fill in the password you want to set '
(Remember that the password must be wrapped in half-width single quotation marks.)
Above the mysqladmin command, I did not write the full path. Because we have set the environment variables above, if you do not set the environment variables, you need to use/usr/local/mysql/bin/mysqladmin ******** to run.
END
V. Installation of phpMyAdmin or Adminer
VI. Setting up a virtual host
Vii. about PHP.ini