Enabling apache and PHP on Mountain Lion

Mac OS X 10.8.1 (Moutain Lion) comes with both Apache and PHP preinstalled, but the Web Sharing option from System preferences disappeared and PHP is not enabled by default. The following instructions should help you get your Web server up and running in a breeze.

Web Sharing — option removed from System Preferences. Apache is still included with the operating system and can be enabled using third-party software.[37]

The Geek way will use the terminal application, but you can also use Finder to search for the files (the Go menu will help you get there directly) and edit them with your favorite text editor.

So, enough talk, open a shell, terminal, bash whatever you call it!
Then enter:
cd /private/etc/apache2/

That should look like:

Should I mention to press enter?
Then type the following command to edit the apache configuration file:
sudo nano httpd.conf

Press enter and enter your password at the prompt.

This opens httpd.conf, the main configuration file for Apache, don’t mess it up!!
 Scroll down until you find the code shown in the following screenshot: 

Position your cursor at the beginning of the line:

#LoadModule php5_module libexec/apache2/libphp5.so
 and remove the hash or pound sign (#). It should now look like this:

LoadModule php5_module libexec/apache2/libphp5.so
Et voilà, this enables PHP 5 on your computer.

Now save the file:
^O
And exit nano:
^X
Now we need to create a configuration file for PHP.

Enter the following commands one by one:
First to go to the correct directory:
cd .. or cd /private/etc/

Then copy the default file provided from php.ini.default to php.ini

In other words, you create a php.ini file with default parameters.

sudo cp php.ini.default php.ini
enter your password again at the prompt
Now, let’s edit the file:
sudo nano php.ini
The most important change is to a command called error_reporting to avoid a server a bit too chatty.The default setting looks like this:
error_reporting = E_ALL & ~E_NOTICE
change it to:
error_reporting = E_ALL

This ensures that PHP reports all errors, but nothing more. Although no one likes error messages, it’s vital to eliminate any errors (even seemingly minor ones) before deploying scripts on a live web server.

NOTE: There are several lines that look similar. Make sure that you edit the line that does NOT begin with a semicolon. A semicolon at the beginning of a line in php.ini indicates a comment, which is ignored by the server.

save php.ini:
^O
exit nano:
^X
To restart the Apache Web server you can go the geek way or reinstall the option in System preferences.

For the geek way, you need to do this :
sudo apachectl restart
enter your password at the prompt

Useful apachectl commands include:

  • apachectl start
  • apachectl stop
  • apachectl restart
  • apachectl -t
or you can reinstall the Web Sharing option from System preferences, provided by a gentleman at: 
Enjoy your brand new personal Web server!

Publicités

Enabling apache and PHP on Mountain Lion

Mac OS X 10.8.1 (Moutain Lion) comes with both Apache and PHP preinstalled, but the Web Sharing option from System preferences disappeared and PHP is not enabled by default. The following instructions should help you get your Web server up and running in a breeze.

Web Sharing — option removed from System Preferences. Apache is still included with the operating system and can be enabled using third-party software.[37]

The Geek way will use the terminal application, but you can also use Finder to search for the files (the Go menu will help you get there directly) and edit them with your favorite text editor.

So, enough talk, open a shell, terminal, bash whatever you call it!

Then enter:
cd /private/etc/apache2/

That should look like:

Should I mention to press enter?
Then type the following command to edit the apache configuration file:
sudo nano httpd.conf

Press enter and enter your password at the prompt.

This opens httpd.conf, the main configuration file for Apache, don’t mess it up!!

 Scroll down until you find the code shown in the following screenshot: 

Position your cursor at the beginning of the line:

#LoadModule php5_module libexec/apache2/libphp5.so

 and remove the hash or pound sign (#). It should now look like this:

LoadModule php5_module libexec/apache2/libphp5.so

Et voilà, this enables PHP 5 on your computer.

Now save the file:
^O
And exit nano:
^X

Now we need to create a configuration file for PHP.

Enter the following commands one by one:
First to go to the correct directory:
cd .. or cd /private/etc/

Then copy the default file provided from php.ini.default to php.ini

In other words, you create a php.ini file with default parameters.

sudo cp php.ini.default php.ini
enter your password again at the prompt

Now, let’s edit the file:
sudo nano php.ini

The most important change is to a command called error_reporting to avoid a server a bit too chatty.The default setting looks like this:
error_reporting = E_ALL & ~E_NOTICE
change it to:
error_reporting = E_ALL

This ensures that PHP reports all errors, but nothing more. Although no one likes error messages, it’s vital to eliminate any errors (even seemingly minor ones) before deploying scripts on a live web server.

NOTE: There are several lines that look similar. Make sure that you edit the line that does NOT begin with a semicolon. A semicolon at the beginning of a line in php.ini indicates a comment, which is ignored by the server.

save php.ini:
^O
exit nano:
^X

To restart the Apache Web server you can go the geek way or reinstall the option in System preferences.

For the geek way, you need to do this :
sudo apachectl restart
enter your password at the prompt

Useful apachectl commands include:

  • apachectl start
  • apachectl stop
  • apachectl restart
  • apachectl -t
or you can reinstall the Web Sharing option from System preferences, provided by a gentleman at: 

Enjoy your brand new personal Web server!

DRM-free ebooks and music in pay-what-you-want bundles! | Defective by Design

The success of DRM-free bundles has been a powerful counterargument to the claim that Digital Restrictions Management is necessary for sustainable digital publishing. These bundles are forming around music and literature, and really showcase being DRM-free as a major selling point. Now, the Big Bang Bundle by StoryBundle has just launched, and the Humble Music Bundle has just a couple hours to go! Both of these are pay-what-you-want bundles that allow you to choose how much money goes to the artist, to the bundle, and to the charity they are benefiting.

DRM-free ebooks and music in pay-what-you-want bundles! | Defective by Design

The success of DRM-free bundles has been a powerful counterargument to the claim that Digital Restrictions Management is necessary for sustainable digital publishing. These bundles are forming around music and literature, and really showcase being DRM-free as a major selling point. Now, the Big Bang Bundle by StoryBundle has just launched, and the Humble Music Bundle has just a couple hours to go! Both of these are pay-what-you-want bundles that allow you to choose how much money goes to the artist, to the bundle, and to the charity they are benefiting.