Today's Question:  What's your opinion about Alibaba mooncake incident?        GIVE A SHOUT

Technical Article => Web =>  PHP

PHP Apache MySQL Set-up Note

  Qiang Hu      2014-04-07 01:56:43      2,554    0    0

With the emergence of WAMP, LAMP, PHP developers are liberated from the tedious work of setting up PHP environment. Since PHP, Apache and MySQL are so tightly bundled, WAMP and LAMP provide a setp solution for setting up a PHP environment which includes the programming programming environment, server and database. But for a PHP who wants to learn more, you have to try to set the PHP environment yourself by installing PHP, Apache and MySQL manually and configuring them.

Below is a simple note on how to setup the PHP environment on Mac OS X. This setup guide should also be helpful on other systems.

1. Apache is pre-installed in Mac OS X, and it can be started by running sudo apachectl start in terminal. After this,

It works!

is shown when visiting localhost in browser. Create a Sites folder in your home folder, then this folder is accessible through localhost/~yourusername.

2. Enable PHP by uncommenting LoadModule php5_module libexec/apache2/libphp5.so in /etc/apache2/httpd.conf. Then restart Apache via sudo apachectl restart. To verify if php works, creating a phpinfo.php in the Sites folder:

<?php
  phpinfo();
?>
When visiting localhost/~yourusername/phpinfo.php you should see php mata information instead of plain text of the code.

– Install MySQL and phpMyAdmin – Set MySQL root password mysqladmin -u root password PASSWORD
If you’re getting #2002 Cannot log in to the MySQL server when logging in to phpmyadmin, try editing phpmyadmin/config.inc.php and change:
$cfg['Servers'][$i]['host'] = 'localhost';
to: $cfg['Servers'][$i]['host'] = '127.0.0.1';
– Create VirtualHost by adding to the end of /etc/apache2/extra/httpd-vhosts.conf

<VirtualHost *:80>
        DocumentRoot "PATH TO SITE ROOT"
        ServerName "SERVER.local"
        ErrorLog "/private/var/log/apache2/jason.local-error_log"
        CustomLog "/private/var/log/apache2/jason.local-access_log" common

        <Directory "PATH TO SITE ROOT">
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>
<VirtualHost *:80>
  DocumentRoot "PATH TO SITE ROOT"
  ServerName "SERVER.local"
  ErrorLog "/private/var/log/apache2/"SERVER.local"-error_log"
  CustomLog "/private/var/log/apache2/"SERVER.local"-access_log" common
  <Directory "PATH TO SITE ROOT">
      Options +Indexes
      AllowOverride All
      Order allow,deny
      Allow from all
  </Directory>
</VirtualHost>

3. Edit /etc/hosts to append 127.0.0.1 SERVER.local

Author : Qiang Hu Source : http://qiang.hu/2014/03/php-apache-mysql-set-up-note.html

PHP APACHE MYSQL

  SAVE AS PDF   MARK AS READ   MARK AS IMPORTANT

  RELATED


  0 COMMENT


No comment for this article.


  WRITE ARTICLE

Can you guess the end?

By sonic0002
When two cars are competing for the same lane, the unexpected happens.