Thursday, April 4, 2013

windows+apache+mysql+php(WAMP) for 64 bits

1. widows:
      we process this on 64 bit windows 7:
2. apache:
     I chooose: httpd-2.4.4-win64.zip
     create one folder:   C:/apache64,  unzip the file to that directory, and thus we can access httpd.conf file by :

   C:/apache64/conf/httpd.conf .
  
   modify this file:

   ServerRoot "C:/apache64"
   ServerName localhost:80
  DocumentRoot "D:\CZG\PHP_WEB"
  <Directory "D:\CZG\PHP_WEB">
   DirectoryIndex index.html index.htm index.php
   ScriptAlias /cgi-bin/ "C:/apache64/cgi-bin/"

 thus, when you input: http://localhost in your broswer, it will redirct you to D:\CZG\PHP_WEB

add your apache to system path by:
add  C:/apache64/bin/ to the path variable of your system.

then you can use the following on your cmd:
httpd.exe -k install
httpd.exe -k start


finally  you open bin folder and double click the ApacheMonitor.exe file.
If you input: http://localhost in your broswer now, it will display: it works!

when you run into problems with this, such as : the requested operation has failed.
you can using the following command line to check the reason:
httpd.exe -w -n "Apache2" -k start
it will give the specific error

3. php:
i choose: php-5.4.3-Win32-VC9-x64.zip
and unzip it to:  C:/php .
then in C:/apache64/conf/httpd.conf to add this or make it effective


LoadModule php5_module "C:/php/php5apache2_4.dll"   // for this case, is 2_4 not 2_2
AddType application/x-httpd-php .php
 # configure the path to php.ini
PHPIniDir "C:/php"

then rename the file php.ini-development to php.ini, and add or  make the following effective
extension_dir = "C:/php/ext/"
allow_url_fopen = Off
extension=php_gd2.dll
extension=php_mysql.dll;
extension=php_zip.dll
Set sendmail from e-mail address:
sendmail_from =xxx@gmail.com

Some settings for MySQL:  
mysql.default_port = 3306
mysql.default_host = localhost


Some settings for session:
session.save_path = "C:/my_session" 
//to same sesssion file and creat one folder like C:/my_session

4.mysql:

i choose: mysql-essential-5.1.68-winx64.msi
install it by defauly, and do not forget the user name and passwork during the installing process
i choose username: root, password: 1234(anyone you like, as long as you can remeber)

then in the D:\CZG\PHP_WEB, create one test.php with the following content:

<?php
$con = mysql_connect("localhost:3306","root","1234"); if (!$con)   {   die("Could not connect: " . mysql_error());   }   else   {     echo "it is connected to database!";   } mysql_close($con);
?>

then run it @ http://localhost/test.php

in my case, I can user localhost:3306 or 127.0.0.1:3306   but when I remove :3306, it dose not work.
i know the port for mysql is 3306, but I am sure, for my previous 32 bit version configuration, it dose not need to add the port in the php code. 

one more thing: for windows 7, the database would be by default stored in:

C:\ProgramData\MySQL\MySQL Server 5.1\data

you can modify this directory at:

C:\Program Files\MySQL\MySQL Server 5.1\my.ini
datadir="C:/ProgramData/MySQL/MySQL Server 5.1/Data/"


5. workbench

to better visualize the mysql  database, I installed workbench:mysql-workbench-gpl-5.2.42-win32.msi.
for first time, it needs the same user name and password, then you can see the table contents of your database like using excel.



No comments:

Post a Comment