Oracle Certification is one of the most treasured certification around the world. Oracle Announced the latest Oracle Software to be launched in September 2007, i.e. ORACLE 11i, as the world await the introduction of the new master piece from Oracle, 10g is still playing a very important role in database management.
To become an Oracle Certified professional, you would have to study Oracle 10g Administration I and Administration II to become Oracle Certified Associate and Oracle Certified Professional respectively.
If you require the necessary materials or dumbs for the Oracle certification, reply this post.
Thursday, June 21, 2007
Installing PHP, MySQL, and Apache on Mac OS X
Many Mac OS X users seem to be having problems getting AMP (Apache, MySQL, and PHP) working properly on various versions of the operating system. In this article, I will describe the process by which I did this on my Powerbook which started out running Panther (10.3) and then Tiger (10.4) (the instructions are the same for both OSes).
Before we begin, we need to talk about the vehicle via which we will do most of our work: Terminal. Since OS X is effectively Unix (It is in fact a modern port and update of the NeXTStep operating system from the late 1980s and early 1990s), you can use command shells to work your way around the system and execute commands. You should definitely make a point of becoming somewhat familiar with this before beginning working with AMP on your computer.
Terminal is found under /Applications/Utilities/Terminal.app. You can launch it from the finder, and you will see something like the following:
While a full treatment of how to use Terminal and bash are beyond the scope of this article, here are some basic commands with which you should be comfortable:
Yukimura:~ marcwan$ mkdir src
Yukimura:~ marcwan$ ls
Desktop Library Pictures src
Documents Movies Sites striptags1.txt
Download Music phpwa work
Yukimura:~ marcwan$ ls -alF
total 379816
drwxr-xr-x 28 marcwan marcwan 952 Jun 16 15:46 ./
drwxrwxr-t 6 root admin 204 May 29 12:22 ../
-rw-r----- 1 marcwan marcwan 12292 Jun 16 19:34 .DS_Store
drwx------ 20 marcwan marcwan 680 Jun 15 14:56 .Trash/
-rw------- 1 marcwan marcwan 6238 Jun 15 23:50 .bash_history
-rw-r----- 1 marcwan marcwan 91 Jun 6 15:44 .bash_profile
-rw------- 1 marcwan marcwan 51 Jun 16 14:34 .cvspass
-rw-r----- 1 marcwan marcwan 687 May 8 18:10 .emacs
drwxr-x--- 4 marcwan marcwan 136 May 7 13:41 .emacs.d/
-rw------- 1 marcwan marcwan 762 Jun 16 11:45 .mysql_history
drwx------ 3 marcwan marcwan 102 May 21 19:38 .ssh/
-rw------- 1 marcwan marcwan 3896 Jun 6 15:44 .viminfo
drwx------ 4 marcwan marcwan 136 Jun 16 15:46 Desktop/
drwx------ 11 marcwan marcwan 374 Jun 15 23:12 Documents/
drwxr-x--- 21 marcwan marcwan 714 Jun 16 20:04 Download/
drwx------ 35 marcwan marcwan 1190 Jun 5 15:12 Library/
drwx------ 5 marcwan marcwan 170 Jun 13 17:22 Movies/
drwx------ 4 marcwan marcwan 136 May 21 20:05 Music/
drwx------ 77 marcwan marcwan 2618 Jun 16 15:46 Pictures/
drwxr-xr-x 11 marcwan marcwan 374 Jun 13 17:31 Sites/
drwxr-xr-x 11 marcwan marcwan 374 Jun 15 14:58 phpwa/
drwxr-xr-x 14 marcwan marcwan 476 Jun 16 14:37 src/
-rw-r--r-- 1 marcwan marcwan 10256 Jun 16 14:19 striptags1.txt
drwxr-x--- 4 marcwan marcwan 136 Jun 16 20:05 work/
Yukimura:~ marcwan$ cd src
Yukimura:~ marcwan$ ls
Yukimura:~ marcwan$ ls -alF
total 0
drwxr-xr-x 2 marcwan marcwan 68 Jun 16 20:30 ./
drwxr-xr-x 29 marcwan marcwan 986 Jun 16 20:30 ../
And so on … You should be proficient at moving around directories in Terminal, and also with running various commands.
To get AMP up and running, you will need the following software:
The latest version of XCode from the Apple developer website, developer.apple.com. This containers all of the compilers and header files and what not that you actually need to build the software. The base OS X operating system does not ship with the necessary compilers and headers.
MySQL 4.1.xx for Mac OS X. The latest version right now is 4.1.12a, and can be obtained from the MySQL Downloads Page. I just downloaded the installer package for Mac OS X 10.3, which worked perfectly fine on both Panther and Tiger (10.4). Please note that I did have troubles with some other builds, most notable the 5.0.x versions of MySQL. Your mileage may vary.
Libxml2. This will be needed to get some of the XML features in PHP working (very much worth having).
Optional Apache 1.3.33, which can can be obtained form the Apache HTTP Server Download pages.
The last of these software packages is optional because Mac OS X actually ships with a working copy of the 1.3 series of the Apache HTTP Server already! On Panther this is 1.3.29 while on Tiger it’s 1.3.33. If you are planning on using the system mostly for development and not for a live web server, then there is no reason not to use the included version of Apache. It’s so convenient.
We will assume you have downloaded these software packages to the Download folder in your home directory, and will begin by opening up a Terminal window.
Last login: Thu Jun 16 14:05:18 on ttyp2
Welcome to Darwin!
Yukimura:~ marcwan$
We will show the installation procedures for MySQL and PHP now, and show the optional instructions for Apache last, if you choose to use them.
Installing MySQL on Mac OS X
Because MySQL ships as an installer package, you actually can still use the Finder to install it. Go to the Download folder, and double click on the mysql-standard-4.1.12-apple-darwin6.8-powerpc.dmg icon (phew!). A New Finder window will open with the icons for the installer, a startup-item installer, and a README. Double Click on the mysql-standard-4.1.12-apple-darwin6.8-powerpc.pkg icon, and you will see something like the following:
Just follow the wizard through the rest of the steps for installation—it creates all of the appropriate accounts and installs the software in /usr/local/mysql (in fact it installs it in /usr/local/mysql-standard-4.1.12-apple-darwin6.8-powerpc and creates a symbolic link to /usr/local/mysql). Once it is done, you can execute your first command in the Terminal window to start the server:
Yukimura:~ marcwan$ sudo /usr/local/mysql/bin/safe_mysqld -user=mysql &
Because you are using the sudo command to execute things with super-user privileges, you will be asked for your password. The MySQL server will now be running and operational (w000t). To verify the operation, you should be able to execute:
Yukimura:~ marcwan$ /usr/local/mysql/bin/mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 734 to server version: 4.1.12-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Congratulations, MySQL is now up and running. We’ll now move on to PHP 5.
Installing PHP5 on Mac OS X
To get PHP running, we will compile it (this will give us the most flexibility and let us choose the modules and options we want to use). Before we can do this, however, we will build and install the libxml2 package which enables all of the cool XML features in PHP 5.
Yukimura:~ marcwan$ cd ~/work
Yukimura:~ marcwan$ tar xfz ~/Download/libxml2-2.6.19.tar.gz
Yukimura:~ marcwan$ cd libxml2-2.6.19
Yukimura:~ marcwan$ ./configure --prefix=/usr/local
Yukimura:~ marcwan$ make
Yukimura:~ marcwan$ sudo make install
Password: ******
Now we’re ready to build PHP5. We will unpack, configure, build, and install it. The only trick is that we will have it install everything into /usr/local/php5 so as to not interfere with any other software on the computer.
First step, unpacking:
Yukimura:~ marcwan$ cd ~/work
Yukimura:~ marcwan$ tar xfj ~/Download/php-5.04.tar.bz2
Yukimura:~ marcwan$ cd php-5.0.4
Second step, configuring. We need to give it a few paths, most notably the location of the Apache dynamic module loader (apxs) as well as tell it which modules we want. I usually build with multi-byte support (mbstring), SOAP (soap), and mysqli (a newer, improved version of the mysql module).
Yukimura:~ marcwan$ ./configure --prefix=/usr/local/php5 \
--with-apxs=/usr/sbin/apxs --with-libxml=/usr/local \
--with-mbstring --with-mbregex --enable-soap \
--with-mysqli=/usr/local/mysql/bin/mysql_config
If you want to use the older mysql extension instead of MySQLi, this is how it’s done:
Yukimura:~ marcwan$ ./configure --prefix=/usr/local/php5 \
--with-apxs=/usr/sbin/apxs --with-libxml=/usr/local \
--with-mbstring --with-mbregex --enable-soap \
--with-mysql=/usr/local/mysql
Next, we build the PHP software:
Yukimura:~ marcwan$ make
And finally, we install it (making sure to copy over a php.ini as well):
Yukimura:~ marcwan$ sudo make install
Password: **********
Yukimura:~ marcwan$ sudo cp php.ini-dist /usr/local/php5/lib/php.ini
PHP5 is now compiled and installed. Unfortunately, we’re not quite done yet. The Apache that ships on our system comes with PHP 4 installed, and needs to be told where to find our magical new PHP5. This is done by editing /private/etc/httpd/httpd.conf. This requires the use of a text editor. Mac OS X ships with both vi and emacs, so you can do:
Yukimura:~ marcwan$ sudo vi /private/etc/httpd/httpd.conf
Yukimura:~ marcwan$ sudo emacs /private/etc/httpd/httpd.conf
Password: **********
If you are not comfortable or familiar with either of these editors, we can still use the TextEdit application that ships with OS X, but must do things in a slightly roundabout fashion. We will copy the file to the current directory, edit it, and then copy it back:
Yukimura:~ marcwan$ cd ~/home
Yukimura:~ marcwan$ cp /private/etc/httpd/httpd.conf .
[edit the file using TextEdit.app]
Yukimura:~ marcwan$ sudo cp httpd.conf /private/etc/httpd
Password: ***
And now the actual editing work: The default httpd.conf on your system is configured for PHP4. We will make three small changes to the file to tell it to use PHP5 instead.
First, we will look for a section filled with:
#LoadModule unique_id_module libexec/httpd/mod_unique_id.so
LoadModule setenvif_module libexec/httpd/mod_setenvif.so
#LoadModule dav_module libexec/httpd/libdav.so
#LoadModule ssl_module libexec/httpd/libssl.so
#LoadModule perl_module libexec/httpd/libperl.so
LoadModule php4_module libexec/httpd/libphp4.so
LoadModule hfs_apple_module libexec/httpd/mod_hfs_apple.so
LoadModule bonjour_module libexec/httpd/mod_bonjour.so
What we will do is comment out the line with php4_module and add in a new one for PHP5:
#LoadModule php4_module libexec/httpd/libphp4.so
LoadModule php5_module /usr/local/php5/libexec/httpd/libphp5.so
Next, we will look for a section similar to the following:
AddModule mod_setenvif.c
#AddModule mod_dav.c
#AddModule mod_ssl.c
#AddModule mod_perl.c
AddModule mod_php4.c
AddModule mod_hfs_apple.c
AddModule mod_bonjour.c
Again, we will comment out the PHP4 line and add in a PHP5 line:
#AddModule mod_php4.c
AddModule mod_php5.c
And finally, we will look for the following section in httpd.conf:
# If php is turned on, we repsect .php and .phps files.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# Since most users will want index.php to work we
# also automatically enable index.php
DirectoryIndex index.html index.php
Again, we will just change it from php4 to php5:
# If php is turned on, we repsect .php and .phps files.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# Since most users will want index.php to work we
# also automatically enable index.php
DirectoryIndex index.html index.php
And you’re done!
To get things working and test it out, edit /Library/WebServer/Documents/test.php:
And now we can start the server:
Yukimura:~ marcwan$ sudo /usr/sbin/apachectl start
Password: **********
Processing config directory: /private/etc/httpd/users/*.conf
Processing config file: /private/etc/httpd/users/marcwan.conf
Processing config file: /private/etc/httpd/users/visitor.conf
/usr/sbin/apachectl start: httpd started
You can view your file by typing in http://localhost/test.php into the address bar of your favourite browser on your Mac.
Congratulations! You now have a working AMP Stack on your machine.
Rolling your Own Apache
If you decide that you’d rather not use the built-in Apache that ships with your Macintosh, then you can easily build and run your own. Again, the process involves unpacking the software, configuring the build, compiling the software, and installing it.
We should do this before we build PHP 5 so that we can tell the latter where our new version of apxs is.
First, unpacking the software:
Yukimura:~ marcwan$ cd ~/work
Yukimura:~ marcwan$ tar xfz ~/Download/apache_1.3.33.tar.gz
Yukimura:~ marcwan$ cd apache_1.3.33
Next we will configure the software. I always enabled the shared object (so) module and typically also include mod_rewrite:
Yukimura:~ marcwan$ ./configure --prefix=/usr/local/apache \
--enable-module=so --enable-module-rewrite
Now we just compile the software, and then install it with super-user privileges:
Yukimura:~ marcwan$ make
Yukimura:~ marcwan$ sudo make install
Password: ***********
Before we run it, we should configure the software, using either emacs, vi, or the copy-and-TextEdit solution we showed above for PHP.
We need to add the following three things to the /usr/local/apache/conf/httpd.conf file:
First, in the section where all the other LoadModule calls are, add the following:
LoadModule php5_module libexec/libphp5.so
Next, in the section with all the AddModule calls, we need to add:
AddModule mod_php5.c
Finally, where all the other AddType directives are included, we will add:
AddType application/x-httpd-php .php
We will change our PHP configuration to point at the apxs for this new Apache installation instead
--with-apxs=/usr/local/mysql/bin/apxs
To test and run this new Apache build:
Yukimura:~ marcwan$ sudo /usr/local/apache/bin/apachectl start
Password: *****
Before we begin, we need to talk about the vehicle via which we will do most of our work: Terminal. Since OS X is effectively Unix (It is in fact a modern port and update of the NeXTStep operating system from the late 1980s and early 1990s), you can use command shells to work your way around the system and execute commands. You should definitely make a point of becoming somewhat familiar with this before beginning working with AMP on your computer.
Terminal is found under /Applications/Utilities/Terminal.app. You can launch it from the finder, and you will see something like the following:
While a full treatment of how to use Terminal and bash are beyond the scope of this article, here are some basic commands with which you should be comfortable:
Yukimura:~ marcwan$ mkdir src
Yukimura:~ marcwan$ ls
Desktop Library Pictures src
Documents Movies Sites striptags1.txt
Download Music phpwa work
Yukimura:~ marcwan$ ls -alF
total 379816
drwxr-xr-x 28 marcwan marcwan 952 Jun 16 15:46 ./
drwxrwxr-t 6 root admin 204 May 29 12:22 ../
-rw-r----- 1 marcwan marcwan 12292 Jun 16 19:34 .DS_Store
drwx------ 20 marcwan marcwan 680 Jun 15 14:56 .Trash/
-rw------- 1 marcwan marcwan 6238 Jun 15 23:50 .bash_history
-rw-r----- 1 marcwan marcwan 91 Jun 6 15:44 .bash_profile
-rw------- 1 marcwan marcwan 51 Jun 16 14:34 .cvspass
-rw-r----- 1 marcwan marcwan 687 May 8 18:10 .emacs
drwxr-x--- 4 marcwan marcwan 136 May 7 13:41 .emacs.d/
-rw------- 1 marcwan marcwan 762 Jun 16 11:45 .mysql_history
drwx------ 3 marcwan marcwan 102 May 21 19:38 .ssh/
-rw------- 1 marcwan marcwan 3896 Jun 6 15:44 .viminfo
drwx------ 4 marcwan marcwan 136 Jun 16 15:46 Desktop/
drwx------ 11 marcwan marcwan 374 Jun 15 23:12 Documents/
drwxr-x--- 21 marcwan marcwan 714 Jun 16 20:04 Download/
drwx------ 35 marcwan marcwan 1190 Jun 5 15:12 Library/
drwx------ 5 marcwan marcwan 170 Jun 13 17:22 Movies/
drwx------ 4 marcwan marcwan 136 May 21 20:05 Music/
drwx------ 77 marcwan marcwan 2618 Jun 16 15:46 Pictures/
drwxr-xr-x 11 marcwan marcwan 374 Jun 13 17:31 Sites/
drwxr-xr-x 11 marcwan marcwan 374 Jun 15 14:58 phpwa/
drwxr-xr-x 14 marcwan marcwan 476 Jun 16 14:37 src/
-rw-r--r-- 1 marcwan marcwan 10256 Jun 16 14:19 striptags1.txt
drwxr-x--- 4 marcwan marcwan 136 Jun 16 20:05 work/
Yukimura:~ marcwan$ cd src
Yukimura:~ marcwan$ ls
Yukimura:~ marcwan$ ls -alF
total 0
drwxr-xr-x 2 marcwan marcwan 68 Jun 16 20:30 ./
drwxr-xr-x 29 marcwan marcwan 986 Jun 16 20:30 ../
And so on … You should be proficient at moving around directories in Terminal, and also with running various commands.
To get AMP up and running, you will need the following software:
The latest version of XCode from the Apple developer website, developer.apple.com. This containers all of the compilers and header files and what not that you actually need to build the software. The base OS X operating system does not ship with the necessary compilers and headers.
MySQL 4.1.xx for Mac OS X. The latest version right now is 4.1.12a, and can be obtained from the MySQL Downloads Page. I just downloaded the installer package for Mac OS X 10.3, which worked perfectly fine on both Panther and Tiger (10.4). Please note that I did have troubles with some other builds, most notable the 5.0.x versions of MySQL. Your mileage may vary.
Libxml2. This will be needed to get some of the XML features in PHP working (very much worth having).
Optional Apache 1.3.33, which can can be obtained form the Apache HTTP Server Download pages.
The last of these software packages is optional because Mac OS X actually ships with a working copy of the 1.3 series of the Apache HTTP Server already! On Panther this is 1.3.29 while on Tiger it’s 1.3.33. If you are planning on using the system mostly for development and not for a live web server, then there is no reason not to use the included version of Apache. It’s so convenient.
We will assume you have downloaded these software packages to the Download folder in your home directory, and will begin by opening up a Terminal window.
Last login: Thu Jun 16 14:05:18 on ttyp2
Welcome to Darwin!
Yukimura:~ marcwan$
We will show the installation procedures for MySQL and PHP now, and show the optional instructions for Apache last, if you choose to use them.
Installing MySQL on Mac OS X
Because MySQL ships as an installer package, you actually can still use the Finder to install it. Go to the Download folder, and double click on the mysql-standard-4.1.12-apple-darwin6.8-powerpc.dmg icon (phew!). A New Finder window will open with the icons for the installer, a startup-item installer, and a README. Double Click on the mysql-standard-4.1.12-apple-darwin6.8-powerpc.pkg icon, and you will see something like the following:
Just follow the wizard through the rest of the steps for installation—it creates all of the appropriate accounts and installs the software in /usr/local/mysql (in fact it installs it in /usr/local/mysql-standard-4.1.12-apple-darwin6.8-powerpc and creates a symbolic link to /usr/local/mysql). Once it is done, you can execute your first command in the Terminal window to start the server:
Yukimura:~ marcwan$ sudo /usr/local/mysql/bin/safe_mysqld -user=mysql &
Because you are using the sudo command to execute things with super-user privileges, you will be asked for your password. The MySQL server will now be running and operational (w000t). To verify the operation, you should be able to execute:
Yukimura:~ marcwan$ /usr/local/mysql/bin/mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 734 to server version: 4.1.12-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Congratulations, MySQL is now up and running. We’ll now move on to PHP 5.
Installing PHP5 on Mac OS X
To get PHP running, we will compile it (this will give us the most flexibility and let us choose the modules and options we want to use). Before we can do this, however, we will build and install the libxml2 package which enables all of the cool XML features in PHP 5.
Yukimura:~ marcwan$ cd ~/work
Yukimura:~ marcwan$ tar xfz ~/Download/libxml2-2.6.19.tar.gz
Yukimura:~ marcwan$ cd libxml2-2.6.19
Yukimura:~ marcwan$ ./configure --prefix=/usr/local
Yukimura:~ marcwan$ make
Yukimura:~ marcwan$ sudo make install
Password: ******
Now we’re ready to build PHP5. We will unpack, configure, build, and install it. The only trick is that we will have it install everything into /usr/local/php5 so as to not interfere with any other software on the computer.
First step, unpacking:
Yukimura:~ marcwan$ cd ~/work
Yukimura:~ marcwan$ tar xfj ~/Download/php-5.04.tar.bz2
Yukimura:~ marcwan$ cd php-5.0.4
Second step, configuring. We need to give it a few paths, most notably the location of the Apache dynamic module loader (apxs) as well as tell it which modules we want. I usually build with multi-byte support (mbstring), SOAP (soap), and mysqli (a newer, improved version of the mysql module).
Yukimura:~ marcwan$ ./configure --prefix=/usr/local/php5 \
--with-apxs=/usr/sbin/apxs --with-libxml=/usr/local \
--with-mbstring --with-mbregex --enable-soap \
--with-mysqli=/usr/local/mysql/bin/mysql_config
If you want to use the older mysql extension instead of MySQLi, this is how it’s done:
Yukimura:~ marcwan$ ./configure --prefix=/usr/local/php5 \
--with-apxs=/usr/sbin/apxs --with-libxml=/usr/local \
--with-mbstring --with-mbregex --enable-soap \
--with-mysql=/usr/local/mysql
Next, we build the PHP software:
Yukimura:~ marcwan$ make
And finally, we install it (making sure to copy over a php.ini as well):
Yukimura:~ marcwan$ sudo make install
Password: **********
Yukimura:~ marcwan$ sudo cp php.ini-dist /usr/local/php5/lib/php.ini
PHP5 is now compiled and installed. Unfortunately, we’re not quite done yet. The Apache that ships on our system comes with PHP 4 installed, and needs to be told where to find our magical new PHP5. This is done by editing /private/etc/httpd/httpd.conf. This requires the use of a text editor. Mac OS X ships with both vi and emacs, so you can do:
Yukimura:~ marcwan$ sudo vi /private/etc/httpd/httpd.conf
Yukimura:~ marcwan$ sudo emacs /private/etc/httpd/httpd.conf
Password: **********
If you are not comfortable or familiar with either of these editors, we can still use the TextEdit application that ships with OS X, but must do things in a slightly roundabout fashion. We will copy the file to the current directory, edit it, and then copy it back:
Yukimura:~ marcwan$ cd ~/home
Yukimura:~ marcwan$ cp /private/etc/httpd/httpd.conf .
[edit the file using TextEdit.app]
Yukimura:~ marcwan$ sudo cp httpd.conf /private/etc/httpd
Password: ***
And now the actual editing work: The default httpd.conf on your system is configured for PHP4. We will make three small changes to the file to tell it to use PHP5 instead.
First, we will look for a section filled with:
#LoadModule unique_id_module libexec/httpd/mod_unique_id.so
LoadModule setenvif_module libexec/httpd/mod_setenvif.so
#LoadModule dav_module libexec/httpd/libdav.so
#LoadModule ssl_module libexec/httpd/libssl.so
#LoadModule perl_module libexec/httpd/libperl.so
LoadModule php4_module libexec/httpd/libphp4.so
LoadModule hfs_apple_module libexec/httpd/mod_hfs_apple.so
LoadModule bonjour_module libexec/httpd/mod_bonjour.so
What we will do is comment out the line with php4_module and add in a new one for PHP5:
#LoadModule php4_module libexec/httpd/libphp4.so
LoadModule php5_module /usr/local/php5/libexec/httpd/libphp5.so
Next, we will look for a section similar to the following:
AddModule mod_setenvif.c
#AddModule mod_dav.c
#AddModule mod_ssl.c
#AddModule mod_perl.c
AddModule mod_php4.c
AddModule mod_hfs_apple.c
AddModule mod_bonjour.c
Again, we will comment out the PHP4 line and add in a PHP5 line:
#AddModule mod_php4.c
AddModule mod_php5.c
And finally, we will look for the following section in httpd.conf:
# If php is turned on, we repsect .php and .phps files.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# Since most users will want index.php to work we
# also automatically enable index.php
DirectoryIndex index.html index.php
Again, we will just change it from php4 to php5:
# If php is turned on, we repsect .php and .phps files.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# Since most users will want index.php to work we
# also automatically enable index.php
DirectoryIndex index.html index.php
And you’re done!
To get things working and test it out, edit /Library/WebServer/Documents/test.php:
And now we can start the server:
Yukimura:~ marcwan$ sudo /usr/sbin/apachectl start
Password: **********
Processing config directory: /private/etc/httpd/users/*.conf
Processing config file: /private/etc/httpd/users/marcwan.conf
Processing config file: /private/etc/httpd/users/visitor.conf
/usr/sbin/apachectl start: httpd started
You can view your file by typing in http://localhost/test.php into the address bar of your favourite browser on your Mac.
Congratulations! You now have a working AMP Stack on your machine.
Rolling your Own Apache
If you decide that you’d rather not use the built-in Apache that ships with your Macintosh, then you can easily build and run your own. Again, the process involves unpacking the software, configuring the build, compiling the software, and installing it.
We should do this before we build PHP 5 so that we can tell the latter where our new version of apxs is.
First, unpacking the software:
Yukimura:~ marcwan$ cd ~/work
Yukimura:~ marcwan$ tar xfz ~/Download/apache_1.3.33.tar.gz
Yukimura:~ marcwan$ cd apache_1.3.33
Next we will configure the software. I always enabled the shared object (so) module and typically also include mod_rewrite:
Yukimura:~ marcwan$ ./configure --prefix=/usr/local/apache \
--enable-module=so --enable-module-rewrite
Now we just compile the software, and then install it with super-user privileges:
Yukimura:~ marcwan$ make
Yukimura:~ marcwan$ sudo make install
Password: ***********
Before we run it, we should configure the software, using either emacs, vi, or the copy-and-TextEdit solution we showed above for PHP.
We need to add the following three things to the /usr/local/apache/conf/httpd.conf file:
First, in the section where all the other LoadModule calls are, add the following:
LoadModule php5_module libexec/libphp5.so
Next, in the section with all the AddModule calls, we need to add:
AddModule mod_php5.c
Finally, where all the other AddType directives are included, we will add:
AddType application/x-httpd-php .php
We will change our PHP configuration to point at the apxs for this new Apache installation instead
--with-apxs=/usr/local/mysql/bin/apxs
To test and run this new Apache build:
Yukimura:~ marcwan$ sudo /usr/local/apache/bin/apachectl start
Password: *****
Installing PHP, MYSQL AND APACHE for Windows
PHP and MySQL are usually associated with LAMP (Linux, Apache, MySQL, PHP). However, most PHP developer ( including me ) are actually using Windows when developing the PHP application. So this page will only cover the WAMP ( Windows, Apache, MySQL, PHP ). You will learn how to install Apache, PHP, and MySQL under Windows platform.
The first step is to download the packages :
Apache : www.apache.org
PHP : www.php.net
MySQL : www.mysql.com
You should get the latest version of each packages. As for the example in this tutorial i'm using Apache 2.0.50 ( apache_2.0.50-win32-x86-no_ssl.msi ), PHP 4.3.10 ( php-4.3.10-Win32.zip ) and MySQL 4.0.18 ( mysql-4.0.18-win.zip ).
Now let's start the installation process one by one.
Installing Apache
Installing PHP
Modifying Apache Configuration
Installing MySQL
Modifying PHP Configuration File
Installing Apache
Installing apache is easy if you download the Microsoft Installer ( .msi ) package. Just double click on the icon to run the installation wizard. Click next until you see the Server Information window. You can enter localhost for both the Network Domain and Server Name. As for the administrator's email address you can enter anything you want.
Click the Next button and choose Typical installation. Click Next one more time and choose where you want to install Apache. Click the Next button and then the Install button to complete the installation process.
To see if you Apache installation was successful open up you browser and type http://localhost in the address bar. If a window with apache settings shows up, congratuations, you have achieved the first stage.
Installing PHP
First, extract the PHP package ( php-4.3.10-Win32.zip ). Extracted the package in the directory where Apache was installed. Change the new created directory name to php ( just to make it shorter ). Then copy the file php.ini-dist in PHP directory to your windows directory ( C:\Windows) and rename the file to php.ini. This is the PHP configuration file and we'll take a look what's in it later on.
Next, move the php4ts.dll file from the newly created php directory into the sapi subdirectory. Quoting from php installation file you can also place php4ts.dll in other places such as :
In the directory where apache.exe is start from ( C:\Program Files\Apache Group\Apache2 \bin)
In your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and %SYSTEMROOT% directory.
Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)
In your whole %PATH%
Modifying Apache Configuration
Apache doesn't know that you just install PHP. We need to tell Apache about PHP and where to find it. Open the Apache configuration file in C:\Program Files\Apache Group\Apache2\conf\httpd.conf and add the following three lines :
LoadModule php4_module php/sapi/php4apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
The first line tells Apache where to load the dll required to execute PHP and the second line means that every file that ends with .php should be processed as a PHP file. You can actually change it to anything you want like .html or even .asp! The third line is added so that you can view your php file source code in the browser window. You will see what this mean when you browse this tutorial and click the link to the example's source code like this one.
Now restart Apache for the changes to take effect ( Start > Programs > Apache HTTP Server 2.0.50 > Control Apache Server > Restart ) . To check if everything is okay create a new file, name it as test.php and put it in document root directory ( C:\Program Files\Apache Group\Apache2\htdocs ). The content of this file is shown below.
phpinfo();
?>
phpinfo() is the infamous PHP function which will spit out all kinds of stuff about PHP and your server configuration. Type http://localhost/test.php on your browser's address bar and if everything works well you should see something like this :
Installing MySQL
First extract the package ( mysql-4.0.18-win.zip ) to a temporary directory, then run setup.exe. Keep clicking the next button to complete the installation. By default MySQL will be installed in C:\mysql.
Open a DOS window and go to C:\mysql\bin and then run mysqld-nt --console , you should see some messages like these :
C:\mysql\bin>mysqld-nt --console
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
040807 10:54:09 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
040807 10:54:11 InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
040807 10:54:12 InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
040807 10:54:31 InnoDB: Started
mysqld-nt: ready for connections.
Version: '4.0.18-nt' socket: '' port: 3306
Now open another DOS window and type C:\mysql\bin\mysql
if your installation is successful you will see the MySQL client running :
C:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Type exit on the mysql> prompt to quit the MySQL client.
Now let's install MySQL as a Service. The process is simple just type mysqld-nt --install to install the service and net start mysql to run the service. But make sure to shutdown the server first using mysqladmin -u root shutdown
C:\mysql\bin>mysqladmin -u root shutdown
C:\mysql\bin>mysqld-nt --install
Service successfully installed.
C:\mysql\bin>net start mysql
The MySQL service was started successfully.
C:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Modifying PHP Configuration File ( php.ini )
PHP stores all kinds of configuration in a file called php.ini.You can find this file in the directory where you installed PHP. Sometimes you will need to modify this file for example to use a PHP extension. I won't explain each and every configuration available just the ones that often need modification or special attention.
Some of the configurations are :
register_globals
error_reporting and display_errors
extension and extension_path
session.save_path
max_execution_time
register_globals
Before PHP 4.2.0 the default value for this configuration is On and after 4.2.0 the default value is Off. The reason for this change is because it is so easy to write insecure code with this value on. So make sure that this value is Off in php.ini.
error_reporting and display_errors
Set the value to error_reporting = E_ALL during development but after production set the value to error_reporting = E_NONE .
The reason to use E_ALL during development is so you can catch most of the nasty bugs in your code. PHP will complain just about any errors you make and spit out all kinds of warning ( for example if you're trying to use an uninitialized variable ).
However, after production you should change the value to E_NONE so PHP will keep quiet even if there's an error in your code. This way the user won't have to see all kinds of PHP error message when running the script.
One important thing to note is that you will also need to set the value of display_erros to On. Even if you set error_reporting = E_ALL you will not get any error message ( no matter how buggy our script is ) unless display_errors is set to On.
session.save_path
This configuration tells PHP where to save the session data. You will need to set this value to an existing directory or you will not be able to use session. In Windows you can set this value as session.save_path = c:/windows/temp/
max_execution_time
The default value for max_execution_time is 30 ( seconds ). But for some scripts 30 seconds is just not enough to complete it's task. For example a database backup script may need more time to save a huge database.
If you think your script will need extra time to finish the job you can set this to a higher value. For example to set the maximun script execution time to 15 minutes ( 900 seconds ) you can modify the configuration as max_execution_time = 900
PHP have a convenient function to modify PHP configuration in runtime, ini_set(). Setting PHP configuration using this function will not make the effect permanent. It last only until the script ends.
IF YOU THINK THIS IS TOO HI-TECH FOR YOU TO UNDERSTAND AND CONFIGURE, I SUGGEST YOU DOWNLOAD WAMP. Wamp Software comes with PHP, MYSQL and APACHE pre-installed and configured, so enjoy
The first step is to download the packages :
Apache : www.apache.org
PHP : www.php.net
MySQL : www.mysql.com
You should get the latest version of each packages. As for the example in this tutorial i'm using Apache 2.0.50 ( apache_2.0.50-win32-x86-no_ssl.msi ), PHP 4.3.10 ( php-4.3.10-Win32.zip ) and MySQL 4.0.18 ( mysql-4.0.18-win.zip ).
Now let's start the installation process one by one.
Installing Apache
Installing PHP
Modifying Apache Configuration
Installing MySQL
Modifying PHP Configuration File
Installing Apache
Installing apache is easy if you download the Microsoft Installer ( .msi ) package. Just double click on the icon to run the installation wizard. Click next until you see the Server Information window. You can enter localhost for both the Network Domain and Server Name. As for the administrator's email address you can enter anything you want.
Click the Next button and choose Typical installation. Click Next one more time and choose where you want to install Apache. Click the Next button and then the Install button to complete the installation process.
To see if you Apache installation was successful open up you browser and type http://localhost in the address bar. If a window with apache settings shows up, congratuations, you have achieved the first stage.
Installing PHP
First, extract the PHP package ( php-4.3.10-Win32.zip ). Extracted the package in the directory where Apache was installed. Change the new created directory name to php ( just to make it shorter ). Then copy the file php.ini-dist in PHP directory to your windows directory ( C:\Windows) and rename the file to php.ini. This is the PHP configuration file and we'll take a look what's in it later on.
Next, move the php4ts.dll file from the newly created php directory into the sapi subdirectory. Quoting from php installation file you can also place php4ts.dll in other places such as :
In the directory where apache.exe is start from ( C:\Program Files\Apache Group\Apache2 \bin)
In your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and %SYSTEMROOT% directory.
Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)
In your whole %PATH%
Modifying Apache Configuration
Apache doesn't know that you just install PHP. We need to tell Apache about PHP and where to find it. Open the Apache configuration file in C:\Program Files\Apache Group\Apache2\conf\httpd.conf and add the following three lines :
LoadModule php4_module php/sapi/php4apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
The first line tells Apache where to load the dll required to execute PHP and the second line means that every file that ends with .php should be processed as a PHP file. You can actually change it to anything you want like .html or even .asp! The third line is added so that you can view your php file source code in the browser window. You will see what this mean when you browse this tutorial and click the link to the example's source code like this one.
Now restart Apache for the changes to take effect ( Start > Programs > Apache HTTP Server 2.0.50 > Control Apache Server > Restart ) . To check if everything is okay create a new file, name it as test.php and put it in document root directory ( C:\Program Files\Apache Group\Apache2\htdocs ). The content of this file is shown below.
phpinfo();
?>
phpinfo() is the infamous PHP function which will spit out all kinds of stuff about PHP and your server configuration. Type http://localhost/test.php on your browser's address bar and if everything works well you should see something like this :
Installing MySQL
First extract the package ( mysql-4.0.18-win.zip ) to a temporary directory, then run setup.exe. Keep clicking the next button to complete the installation. By default MySQL will be installed in C:\mysql.
Open a DOS window and go to C:\mysql\bin and then run mysqld-nt --console , you should see some messages like these :
C:\mysql\bin>mysqld-nt --console
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
040807 10:54:09 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
040807 10:54:11 InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
040807 10:54:12 InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
040807 10:54:31 InnoDB: Started
mysqld-nt: ready for connections.
Version: '4.0.18-nt' socket: '' port: 3306
Now open another DOS window and type C:\mysql\bin\mysql
if your installation is successful you will see the MySQL client running :
C:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Type exit on the mysql> prompt to quit the MySQL client.
Now let's install MySQL as a Service. The process is simple just type mysqld-nt --install to install the service and net start mysql to run the service. But make sure to shutdown the server first using mysqladmin -u root shutdown
C:\mysql\bin>mysqladmin -u root shutdown
C:\mysql\bin>mysqld-nt --install
Service successfully installed.
C:\mysql\bin>net start mysql
The MySQL service was started successfully.
C:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Modifying PHP Configuration File ( php.ini )
PHP stores all kinds of configuration in a file called php.ini.You can find this file in the directory where you installed PHP. Sometimes you will need to modify this file for example to use a PHP extension. I won't explain each and every configuration available just the ones that often need modification or special attention.
Some of the configurations are :
register_globals
error_reporting and display_errors
extension and extension_path
session.save_path
max_execution_time
register_globals
Before PHP 4.2.0 the default value for this configuration is On and after 4.2.0 the default value is Off. The reason for this change is because it is so easy to write insecure code with this value on. So make sure that this value is Off in php.ini.
error_reporting and display_errors
Set the value to error_reporting = E_ALL during development but after production set the value to error_reporting = E_NONE .
The reason to use E_ALL during development is so you can catch most of the nasty bugs in your code. PHP will complain just about any errors you make and spit out all kinds of warning ( for example if you're trying to use an uninitialized variable ).
However, after production you should change the value to E_NONE so PHP will keep quiet even if there's an error in your code. This way the user won't have to see all kinds of PHP error message when running the script.
One important thing to note is that you will also need to set the value of display_erros to On. Even if you set error_reporting = E_ALL you will not get any error message ( no matter how buggy our script is ) unless display_errors is set to On.
session.save_path
This configuration tells PHP where to save the session data. You will need to set this value to an existing directory or you will not be able to use session. In Windows you can set this value as session.save_path = c:/windows/temp/
max_execution_time
The default value for max_execution_time is 30 ( seconds ). But for some scripts 30 seconds is just not enough to complete it's task. For example a database backup script may need more time to save a huge database.
If you think your script will need extra time to finish the job you can set this to a higher value. For example to set the maximun script execution time to 15 minutes ( 900 seconds ) you can modify the configuration as max_execution_time = 900
PHP have a convenient function to modify PHP configuration in runtime, ini_set(). Setting PHP configuration using this function will not make the effect permanent. It last only until the script ends.
IF YOU THINK THIS IS TOO HI-TECH FOR YOU TO UNDERSTAND AND CONFIGURE, I SUGGEST YOU DOWNLOAD WAMP. Wamp Software comes with PHP, MYSQL and APACHE pre-installed and configured, so enjoy
Certification in Oracle, Microsoft, Cisco etc
Certification is often used in the professions of software engineering and information technology.
The most successful certification programs are oriented toward specific technologies, and are managed by the vendors of these technologies. These certification programs are tailored to the institutions that would employ people who use these technologies.
Cisco Systems sponsors the Cisco Career Certifications program
Citrix Systems sponsors the Citrix Certified Administrator program
Hewlett-Packard sponsor various certifications releated to HP Technologies.
IBM sponsors certifications [1]
Juniper Networks sponsors the Juniper Networks Technical Certification Program [2]
Microsoft Corporation sponsors the Microsoft Certified Professional program
MySQL sponsors a certification program [3]
Novell sponsors a certification program
Object Management Group sponsors the Certified Professional program for the Unified Modeling Language
Oracle Corporation sponsors the Oracle Certification Program
Red Hat sponsors the Red Hat Certification Program
Sun Microsystems sponsors the Sun Certified Professional program
European Computer Driving License-Foundation sponsors the European Computer Driving
Linux Professional Institute
Planet3 Wireless sponsors the Certified Wireless Network Administrator (CWNA) certification [4]
Prosoft Learning Corporation offers CIW, CCNT, CTP, AssessPrep certification tracks.
SAGE (organization) sponsors the cSAGE program
SANS Institute operates the Global Information Assurance Certification program
Storage Networking Industry Association (SNIA) sponsors the SNIA Certification Program[5]
The IEEE Computer Society sponsors the Certified Software Development Professional as well as membership designations, "Senior" and "Fellow" which reflect experience and peer review qualification.
The Institute for the Certification of Computing Professionals sponsors the Certified Computing Professional (CCP) and Associate Computing Professional (ACP) certifications
In choosing a professional certification, relevancy to independent skill or acquired knowledge is key. Professional Certification do not only confirm your status as a global staff, it also leverage you among technological personals globally thereby making you a more sort after professional.
I have in stocks, study materials for all certifications exams be it ORACLE, MICROSOFT, CISCO, SUN MICROSYSTEMS ETC.
The most successful certification programs are oriented toward specific technologies, and are managed by the vendors of these technologies. These certification programs are tailored to the institutions that would employ people who use these technologies.
Cisco Systems sponsors the Cisco Career Certifications program
Citrix Systems sponsors the Citrix Certified Administrator program
Hewlett-Packard sponsor various certifications releated to HP Technologies.
IBM sponsors certifications [1]
Juniper Networks sponsors the Juniper Networks Technical Certification Program [2]
Microsoft Corporation sponsors the Microsoft Certified Professional program
MySQL sponsors a certification program [3]
Novell sponsors a certification program
Object Management Group sponsors the Certified Professional program for the Unified Modeling Language
Oracle Corporation sponsors the Oracle Certification Program
Red Hat sponsors the Red Hat Certification Program
Sun Microsystems sponsors the Sun Certified Professional program
European Computer Driving License-Foundation sponsors the European Computer Driving
Linux Professional Institute
Planet3 Wireless sponsors the Certified Wireless Network Administrator (CWNA) certification [4]
Prosoft Learning Corporation offers CIW, CCNT, CTP, AssessPrep certification tracks.
SAGE (organization) sponsors the cSAGE program
SANS Institute operates the Global Information Assurance Certification program
Storage Networking Industry Association (SNIA) sponsors the SNIA Certification Program[5]
The IEEE Computer Society sponsors the Certified Software Development Professional as well as membership designations, "Senior" and "Fellow" which reflect experience and peer review qualification.
The Institute for the Certification of Computing Professionals sponsors the Certified Computing Professional (CCP) and Associate Computing Professional (ACP) certifications
In choosing a professional certification, relevancy to independent skill or acquired knowledge is key. Professional Certification do not only confirm your status as a global staff, it also leverage you among technological personals globally thereby making you a more sort after professional.
I have in stocks, study materials for all certifications exams be it ORACLE, MICROSOFT, CISCO, SUN MICROSYSTEMS ETC.
Subscribe to:
Posts (Atom)