Online has been said does not recommend the removal of OSX from Apache, I am also a cheap hand
But since it has been deleted, you need to put it back, incidentally update the upgrade
All right, let's go.
Directly on the brew installation, save time and effort, if you like manual also suggest to get a brew first
First get Apache, at that time Baidu did not know where to download
Later only to know the original name httpd (lying trough ... )
The first step:
--------------------------------------------------Manual Operation Control--------------------------------------------------
Apache httpd:
Download Link: http://httpd.apache.org/download.cgi
This is PHP, to the old version like 5.3 points to the right of the Old Archives
Download Link: http://php.net/downloads.php
HTTPD installation, the first terminal to run this sentence, 32-bit system host with i386
sudo./configure--prefix=/usr/local/apache2--with-apr=/usr/sbin/apr--with-apr-util=/usr/sbin/apr-util--host= Amd64
Good luck sure no error, bad luck first use brew to pack that Apr and Apr-util bar, what is missing on brew install what
Then just install it on make && make, and the files go to the/usr/local/apache2 after the event.
Open conf inside the httpd.conf configuration serverroot, Listen Port, module, etc.
-----------------------------------------------------------------Lazy Man Control----------------------------------------------------- ------------
What do you need to brew install?
Brew Install HTTPD24 Enter wait
Then add the PHP extension library
Brew tap Homebrew/dupesbrew tap homebrew/phpbrew tap josegonzalez/homebrew-php
Brew Update once and add extensions if you have problems
Finally install PHP, need 5.4 to write php54,5.5 php55, will automatically download the current latest sub-version
For example, I install php53 will download 5.3.29
Brew Install PHP53 Enter wait
If the error indicates what Apxs,apache did not use--enable-so,/usr/share/httpd/build or anything
First create a httpd soft link to the/usr/share, then CD to the httpd directory, then
Ln-s.//usr/share/httpd
installing the error again will solve the problem.
Brew-Installed httpd configuration file in/usr/local/etc/apache2/2.x/
-----------------------------------------------------------------Tail Line----------------------------------------------------- ------------
Don't get too excited, there's a lot of detail to deal with.
Step Two:
Let's edit and edit the httpd.conf file first.
Here are a couple of places we need to change.
1. ServerRoot, the value of httpd is located in the directory, must not be wrong
2. Listen, port number, I'm used to 80
3. LoadModule, if it is manually installed PHP itself CP that so file into the httpd inside the libexec directory, if it is a brew installed
You should automatically add a loadmodule php5_module/usr/local/cellar/php53/5.3.29/libexec/apache2/libphp5.so-like
4. See User Daemon and Group Daemon,daemon change to _www.
5. ServerAdmin, admin mailbox, can change not change
6. ServerName, if the previous # number must be removed, change to localhost or 127.0.0.1
7. DocumentRoot, is the WWW folder under Windows, the proposed change to/users/user name/sites, no Sites new one,
After modification, the following <directory will be changed to the same value as DocumentRoot.
Changed the save, this time we still can not access the PHP page, do not believe in the Sites directory to write a PHP file content
<?phpphpinfo ();? >
of course, before we open it, we'll run the terminal:
sudo apachectl start
Then the browser opens localhost, is not directly out of the PHP code--
Okay, don't be fooled, let's fix this.
Create a new file, such as in the split line:
--------------------------------------------------------------------------------------------------------------- -----
#
# Additional PHP Apache directives,
# part of the entropy.ch PHP package for Mac OS X
#
# For more information, go to http://www.entropy.ch/software/macosx/php/
#
# This PHP module path is changed to its own so file location
LoadModule php5_module/usr/local/cellar/php53/5.3.29/libexec/apache2/libphp5.so
# This is the solution to the PHP display code
<ifmodule mod_php5.c>
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
# This is set to allow default access to index.php
<ifmodule mod_dir.c>
DirectoryIndex index.html index.php
</IfModule>
</IfModule>
--------------------------------------------------------------------------------------------------------------- -----
Save as php.conf, manually install httpd child paper put the file under/etc/.
Brew the children's paper into the/usr/local/etc/php/5.x/.
Then edit the httpd.conf file again
Comment out the Php5_module line in the LoadModule (plus #)
Add a sentence at the end of the file:
Include/etc/php.conf or
Include/usr/local/etc/php/5.x/php.conf
and then save
Step Three:
Open the php.ini file in the PHP directory and find [date", Below a line ;d Ate.timezone =
date.timezone = PRC save
can be resolvedPHP warning:phpinfo (): It is not safe for rely on the systemproblem
Mac OS x Original Apache Delete Post Reload method