Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Apache, Mysql and PHP on your pc  (Read 1916 times)

Joost

  • Guest
Apache, Mysql and PHP on your pc
« on: November 22, 2009, 08:02:48 AM »

It is good practise to write or modify scripts on your pc. After testing, you can upload it to a shared server (or whatever hosting plan your using), for a final test.
Benefits of writing locally are:
- No need to upload scripts over and over again, just to find out you've made a syntax error (forgetting semicolons, brackets).
- The ability to (stress)test the applications without complaints from the hoster (a thousand script requests, might get you penalized).
- The freedom to install or enable debugging tools like Xdebug.

What you need to work on applications (cms) such as sNews is:

Server software: Apache HTTP Server.
A database server: Mysql.
and (of course): PHP.

This will run on most computers that run operating systems like: Windows, Linux or Unix(bsd)

- Another way to install those three is by means of XAMPP. XAMPP provides a one package which includes an installer. It is said to be simpler than installing these applications separately.

Hwever, if you decide to download and install each application separately, you have the advantage of being able to combine the versions you want or need.

When choosing versions and you want a script to run on as many hosting plans as possible, never use, nightly builts, beta version or latest unstable version (these are all buggy). You probably don't even want to use the latest stable release, unless you are willing to search through documentation for significant changes.
For Mysql and Apache, there is little concern: Most developers have to little knowledge of sql to make use of the benefits that come with the latest stable release and Apache doesn't affect much of what we (modders, developers) do.
Concerning PHP: Consider PHP 5 (plus or minus 5.2) safe. However, don't deploy 5.3 or higher as most hosters are reluctant to install those versions (mind the date: November 22 2009).

Additional notes:
- Don't make modifications/scripts that rely upon Pear or [urlhttp://pecl.php.net/]Pecl[/url] packages unless you know the hosting plan supports it.
- On Apache mod_rewrite must be enabled as sNews depends on it (IIS might provide a similar module, but don't count on it).
- Unless you know what you're doing, it is not recommended using your pc as server on the internet. Use it for development and testing only.
« Last Edit: November 22, 2009, 08:16:42 AM by Joost »
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: Apache, Mysql and PHP on your pc
« Reply #1 on: November 22, 2009, 03:36:51 PM »

A note for Mac users: XAMPP has (or had, not sure of current status) a version for Mac OS X. It should not be used simply because it isn't reliable on Mac OS X. It is recommended that you use a native MySQL/Apache/PHP package for Mac like MAMP instead, this is a tried and true solution that runs on just about any Mac and any OS version from 10.4 and up.

You can of course use the built-in Apache, MySQL and PHP packages as well, although that takes more work in setting up than with MAMP. Mod_rewrite must be enabled, the server config file must be modified in respect to follow symlinks and php must generally be added as an allowed file extension.
« Last Edit: November 22, 2009, 03:40:03 PM by Fred K (agentsmith) »
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: Apache, Mysql and PHP on your pc
« Reply #2 on: November 22, 2009, 03:51:49 PM »

Great guy's... I did remove my XAAMP before, and need it back so this is useful info as my memory don't serve as well as it use... ah, who am I kidding, it has never served me ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

nukpana

  • Hero Member
  • *****
  • Karma: 71
  • Posts: 663
Re: Apache, Mysql and PHP on your pc
« Reply #3 on: November 22, 2009, 09:41:39 PM »

To note, for Linux users you can always use your package manager (ala apt (Debian), yum (Suse), pacman (Arch), and so on) to get the software you need.  Doing it this way ensures you are up to date with releases and security patches (like the latest Apache update with Debian based distros).

In Ubuntu this goes like this:

sudo apt-get update
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server php5-sqlite
sudo apt-get install phpmyadmin
sudo a2enmod rewrite
sudo gedit /etc/apache2/sites-enabled/000-default

Change AllowOverride None to AllowOverride All for the /var/www section
sudo /etc/init.d/apache2 force-reload

If you are the only user and using this for dev purposes, then I do this:
sudo nautilus
symlink /var/www to the home/USER directory.
Go back to /var/www - allow the USER to be the group permission
close (root) nautilus

Now you should be able to use the localhost in the userspace

Note for XAMPP - Some WIN versions (I usually use the LITE version) do not enable the following by default. Check the PHP info page to view this.
 - mod rewrite
 - SQLITE3
Logged

hclloveh

  • Newbie
  • *
  • Karma: 0
  • Posts: 6
Re: Apache, Mysql and PHP on your pc
« Reply #4 on: November 08, 2010, 05:40:19 AM »

Enable .htaccess on Windows Server can found here: http://adf.ly/143306/snewsvn.co.cc/loi-thuong-gap/chy-snews-tren-localhost/

See images to understand how to do that. But the most important - edit .httpd at Apache and restart it.

Code: [Select]
AllowOverride None
Edit to

Code: [Select]
AllowOverride All
Logged