Mac OS X Yosemite 10.10 Configuration apache+php Tutorial Considerations

Source: Internet
Author: User
Tags mcrypt zts administrator password

Start Apache First and enter the command in the terminal:

sudo apachectl start

To view the Apache version:

Httpd-v

Under Yosemite 10.10, Apache updated the

Server version:apache/2.4.9 (Unix) server built:   Sep  9 2014 14:48:20

Next Test, I found the following points need to be amended, if there are other questions welcome to exchange:

1. Re-enable PHP to prevent the script from appearing directly on the page

The first is that http://localhost/will display the PHP code directly on the page, where PHP support needs to be turned on:

sudo nano/etc/apache2/httpd.conf

Press Ctrl+w to find and remove the # in front of the line of code, as follows:

LoadModule Php5_module libexec/apache2/libphp5.so
2. Open the Support User level directory http://localhost/~username/

User-level directory cannot be accessed, http://localhost/~haibor/, hint:

Not foundthe requested the URL/~haibor/was not found on the this server.

First configure the haibor.conf Run command:

sudo vi/etc/apache2/users/haibor.conf

Save the following code in the Conf file, not the same as 10.9.X:

<directory "/users/haibor/sites/" >    Options Indexes multiviews    allowoverride None    Require All Granted</directory>

Remember to give permission:

sudo chmod 755/etc/apache2/users/haibor.conf

Here you also need to enable several support to run:

sudo nano/etc/apache2/httpd.conf

Find and remove the # in front of the line of code, enabled as follows:

LoadModule authz_core_module libexec/apache2/mod_authz_core.soloadmodule authz_host_module libexec/apache2/mod_ Authz_host.soloadmodule Userdir_module libexec/apache2/mod_userdir.soinclude/private/etc/apache2/extra/ Httpd-userdir.conf

Then run:

sudo nano/etc/apache2/extra/httpd-userdir.conf

Open:

Include/private/etc/apache2/users/*.conf

Finally, don't forget to restart Apache.

sudo apachectl restart

Try again, is not success!

http://localhost/~haibor/

Note: The Haibor here is the MacBook user name.

Also, if required. htaccess supports pseudo-static rewirte, which requires a line of code to be opened in httpd.conf:

LoadModule Rewrite_module libexec/apache2/mod_rewrite.so

3. First copy the php.ini, then you can configure various PHP functions through the php.ini.

sudo cp/etc/php.ini.default/etc/php.ini

For example, modify the Upload_max_filesize, Memory_limit, post_max_size three values to adjust the maximum value of the PHP commit file, such as the maximum value of the imported data in phpMyAdmin.

Configuring PHP's MCrypt Extension

MCrypt is a powerful encryption algorithm extension library, which includes 22 algorithms, phpMyAdmin relies on this PHP extension library. But its installation under Mac OS X is less friendly, as follows:

Download and unzip the libmcrypt-2.5.8.tar.bz2.

Execute the following command at the terminal (note that the following commands are required to install Xcode support):

CD ~/downloads/libmcrypt-2.5.8/

./configure--disable-posix-threads--enable-static

Make

sudo make install

Download and unzip php source file php-5.3.1.tar.bz2. The PHP version preinstalled in Mac OS X 10.6.3 is 5.3.1, and now the latest PHP version is 5.3.2, you need to choose the appropriate version according to your actual situation.

Execute the following command at the terminal:

CD ~/downloads/php-5.3.1/ext/mcrypt

Phpize

./configure

Make

CD modules

sudo cp mcrypt.so/usr/lib/php/extensions/no-debug-non-zts-20090626/

Open php.ini

sudo vi/etc/php.ini

Add the following code to the php.ini, save and exit, then restart Apache

Extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so

When you revisit http://localhost/~[username]/phpmyadmin, you will find "unable to load the mcrypt extension, please check your PHP configuration." "The hint is gone, which means the MCrypt expansion Library was installed successfully.

4

MYSQLSTARTUPITEM.PKG (MySQL startup project), you can automatically run the MySQL service when your computer starts the system, it installs in/library/startupitems/mysql/, if you do not want to run the MySQL service when the system starts, Please do not install. If you do not want to use it after installation, please delete the/library/startupitems/mysql/directory.

Start the MySQL service

1, if you have installed the MYSQLSTARTUPITEM.PKG, restart the computer.

2, if you have installed mysqlstartupitem.pkg or do not want to start the computer, run: application-utility-terminal, enter command in Terminal: sudo/library/startupitems/mysqlcom/mysqlcom start , then enter your system administrator password.

Turn off MySQL service

Enter the command in Terminal: sudo/library/startupitems/mysqlcom/mysqlcom stop, then enter your system administrator password.

You can also go to System Preferences-other-mysql, through which to start and stop the MySQL service.

Change the MySQL root account password

Terminal input command:/usr/local/mysql/bin/mysqladmin-u root password new password

You can change your password at any time by using this command.

Terminal login MySQL

Terminal Login MySQL

Method 1: Absolute path

Terminal input command:/usr/local/mysql/bin/mysql-u root-p

Tip: Enter your new password

Method 2: (recommended) relative path

Enter the command in the terminal:

To see if there is a path in the path:

Input command in terminal: Echo $PATH

No, go ahead.

Add Required path: path= "$PATH":/usr/local/mysql/bin

later

Input command in terminal: Mysql-u root-p can be

Mac OS X Yosemite 10.10 Configuration apache+php Tutorial Considerations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.