Web Hosting Forum | Lunarpages

Author Topic: Developing locally on your own local PHP/MySQL/Apache server  (Read 71502 times)

Offline Ed

  • Berserker Poster
  • *****
  • Posts: 5177
    • Joke A Whenever
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #15 on: November 12, 2005, 06:01:32 AM »
By default the error reporting is set to display all errors and all warnings.

Do a phpinfo()  on LP if you want to mimic their setup for development.

- Ed

Offline landing

  • PHP Addict
  • Intergalactic Superstar
  • *****
  • Posts: 144
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #16 on: November 12, 2005, 06:18:27 AM »
Lovely stuff.

Thanks Nibbler & Ed.


Cheers
Best regards

Offline landing

  • PHP Addict
  • Intergalactic Superstar
  • *****
  • Posts: 144
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #17 on: November 12, 2005, 08:12:32 AM »
Is it possibly to download or extract a copy of the LP php.ini?

Would save me hours of comparing and amending settings.


Cheers
Best regards

Offline Nibbler

  • 21st century digital boy
  • Master Jedi
  • *****
  • Posts: 1168
    • Coppermine
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #18 on: November 12, 2005, 08:49:14 AM »
First of all disable your custom php.ini if you have one. Then do a phpinfo() which will tell you where the main php.ini file is located on your server. You can then upload and run a php script to copy the file into your home directory for examination. Here's an example, change the paths to suit

Code: [Select]
<?php
passthru
('cp /usr/local/Zend/etc/php.ini ~/server.php.ini');
?>


You probably won't want to use it as it is, as some settings may break your local setup.
Missing since 1983


Offline landing

  • PHP Addict
  • Intergalactic Superstar
  • *****
  • Posts: 144
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #19 on: November 12, 2005, 09:41:44 AM »
Thanks Nibbler. I'll take a look.
Best regards

Offline oxsley

  • Galactic Royalty
  • *****
  • Posts: 360
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #20 on: November 23, 2005, 08:00:44 PM »
For testing purposes, here's a trick I use.... I create a test directory and test files on the live server. But, just before I upload the new test stuff, I edit my .htaccess file to restrict all IP addresses to the test stuff except mine. Something like:

# Restrict access to test directory
RewriteCond %{REQUEST_URI} ^/testdirectory/.*$
RewriteCond %{REMOTE_ADDR} !^12\.345\.678\.999$
RewriteRule .*$ index.html

Basically, this translates as:
Line 1: If the request is for anything in the test directory (testdirectory), and
Line 2: If the request is not from your IP address (12.345.678.999)
Line 3: Re-direct all requests (.*$) to the home page (index.html)

There are other variations, such as you could redirect to a 401 page. The exact edits to your .htaccess file may be slightly different based on what you already have in there. Of course, you'll want to set things back when you are done testing. This trick is probably best for small-scale tests. And, editing your .htaccess file can be tricky... it's easy to make a mistake and mess up access to your site.
« Last Edit: November 23, 2005, 08:07:54 PM by oxsley »

Offline Tom Veik

  • Intergalactic Cowboy
  • *****
  • Posts: 65
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #21 on: December 11, 2005, 06:45:18 PM »
I have PHP MySQL and Apache running in my home windows pc to do testing, but I don't have mod rewrite.  How do I add that?  Does that require a recompile of the EXE?

Offline Tom Veik

  • Intergalactic Cowboy
  • *****
  • Posts: 65
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #22 on: December 11, 2005, 08:01:54 PM »
Never mind, figured it out.  All I had to do was un-comment a couple lines in httpd.conf.

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6229
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #23 on: April 18, 2006, 11:51:04 AM »
xampp works well for this purpose too. Also includes addons phpMyAdmin, and a few other nifty things.

I'm trying to set up LAMPP (XAMPP for Linux) and am having trouble with Perl. I can't run a Perl script either from the URL or via a PHP page. Please see http://www.lunarforums.com/forum/index.php?topic=21408.msg243673#msg243673 for details, if you have any experience with this.

Thanks! Phil
Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-

Offline Rowan

  • hamburglar
  • Über Jedi
  • *****
  • Posts: 1663
  • I used to be Human....2.0b
    • http://row1.info
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #24 on: April 18, 2006, 03:36:54 PM »
@Mr Phill
I just installed xampp last night on my kubuntu machine, i was surprised how easy it was to set up.

Unfortionatly I will be having to do some Perl stuff soon so I'll let you know if I get it going.

One thing to try.
change $otherpage to have a local path instead of a URL.
from http://nz2.php.net/fopen
Quote
If PHP has decided that filename specifies a registered protocol, and that protocol is registered as a network URL, PHP will check to make sure that allow_url_fopen is enabled. If it is switched off, PHP will emit a warning and the fopen call will fail.

Check that the directories have permissions 777.
I found that on lunarpages 755 worked, but 755 didn't work on my local machine.

hope that might help

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6229
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #25 on: April 19, 2006, 01:58:59 PM »
Thanks for the tips, BigBirdFluHuman :-). I'll give 'em a try. Except for the Perl problem, XAMPP has been a very nice testbed for development (so far). It's nice not to have to upload everything to LP and worry about some infinite loop during debugging getting me banished...
Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-

Offline officexpboy

  • Intergalactic Cowboy
  • *****
  • Posts: 62
  • To succeed in your mission, you must have single-minded devotion to your goal
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #26 on: June 23, 2006, 01:58:17 AM »
WAMP  (software bundle) is tool that we can use as development server. Can be offline, only localhost (your computer) can access to your server.
WAMP is acronym for Windows, Apache, MySQL and  PHP.

WAMP5 - contains MySQL 5.0.22, Apache 2.0.58, phpmyadmin 2.8.1) as well as PHP4, MySQL administration and Zend Optimizer add-ons.


I guess WAMP is better option

http://www.wampserver.com/en/
To succeed in your mission, you must have single-minded devotion to your goal

Offline JaphyR

  • Intergalactic Cowboy
  • *****
  • Posts: 69
    • 1000 Random Walks
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #27 on: June 23, 2006, 01:34:28 PM »
I have an unanswered question that I've been ignoring for a while.  I installed PHPerl on my machine a while ago, to have a local testing environment, and it has been very satisfying.  I never did anything, though, to ensure that the server on my laptop is inaccessible to anyone throughmy internet connection.

Is there anything I'm supposed to do that will restrict any and all use of this server to my computer, like changing ports or permissions?
1000 Random Walks - A collaborative art project, using people on the internet as a source of randomness.

Offline GMTurner

  • Berserker Poster
  • *****
  • Posts: 7499
    • Turner's Lounge
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #28 on: June 23, 2006, 08:20:25 PM »
One thing that provides some degree of protection, is the Windows firewall (if you have XP that is...) I wouldn't say it is the best out there, but as long as you do not allow the computer to accept outside connections you should be alright... to be better off, use a product like ZoneAlarm (or other firewall) as an added layer of protection... make sure file sharing is turned off, etc...

And of course the best way at all, don't connect to the internet, but that's always seemed a bit extreme to me :)
The above information may or may not reflect current policy, opinions, or views since it was likely made almost 10 years ago.

Offline Urashmi

  • Tweetle Beetle Battler
  • Trekkie
  • **
  • Posts: 13
Re: Developing locally on your own local PHP/MySQL/Apache server
« Reply #29 on: June 24, 2006, 05:33:06 AM »
I have an unanswered question that I've been ignoring for a while.  I installed PHPerl on my machine a while ago, to have a local testing environment, and it has been very satisfying.  I never did anything, though, to ensure that the server on my laptop is inaccessible to anyone throughmy internet connection.

Is there anything I'm supposed to do that will restrict any and all use of this server to my computer, like changing ports or permissions?

You must ensure there is a firewall between you and the internet, not just for PHPerl, an unprotected PC will be hacked in no time.  Win XP sp2 has a firewall built in, but I recommend using a separate device (e.g. an old 486 PC can easily be configured to act as a firewall), or if you have a broadband connection use a firewall/router/modem, they cost little more than a modem.

 

Share |