# Setting up for PHP programming on new Linux box--what should I choose?



## Alex Ethridge (Apr 10, 2000)

I've already installed (Mandrake 10.1) Linux; but, from what I read about PHP so far, it looks like I should have chosen some server components during the installation, which I didn't.

I want to be able to learn PHP and test run my scripts on the same Linux box. Since I haven't done anything with the installed Linux yet, I can do the installation all over again with no loss.

What should I install the next time around?

With my entire half-hour experience, I now know about as much about Linux as I know about moon rocks so be kind.


----------



## EtHeO (Jul 19, 2005)

Do you know the basix linux commands like ls, cd and that kind of stuff?
If you don't: learn em  try googling for "linux tutorial" 
If you do: go to /usr/home (if i'm not mistaking) and try to find something like htdocs, wwwroot, www or apache. In one of these folders, there should be an index.html. Remove it, then make a new file called index.php. In a web browser (like mozilla) go to http://localhost/index.php . You should then see the parsed page you just created.
If you get a 404 document, but http://localhost/ doesn't give any errors, you probably have made the index.php file in the wrong directory.
If you get a No Connection Could Be Made document, then you need to reconfigure your mandrake installation. You can do this with Packet Manager. Select the packets Apache, PHP and MySQL. (the names may vary with version numbers, like PHP-4.3.10 or Apache-1.3.18.
Install the packets, and try again.

Let me know if this works.


----------



## Alex Ethridge (Apr 10, 2000)

Wouldn't it be easier, since I know nothing of what you write, to just reinstall and make the right choices?

I've just installed it and have done nothing to it since the install except look around.


----------



## EtHeO (Jul 19, 2005)

You'll need to work with linux anyway


----------



## brendandonhu (Jul 8, 2002)

Mandrake has a checkbox during the install, you just have to click it to install server packages.
And you will still need to learn Linux, or your server WILL get hacked.

http://tldp.org/LDP/intro-linux/html/intro-linux.html
http://tldp.org/LDP/sag/html/sag.html
http://tldp.org/LDP/Linux-Dictionary/html/Linux-Dictionary.html


----------



## Alex Ethridge (Apr 10, 2000)

Thanks for the links.


> Mandrake has a checkbox during the install, you just have to click it to install server packages.


I remember several check-boxes there--which boxes--which components?


> will still need to learn Linux, or your server WILL get hacked


This will not be employed as a web server. It's just for me to learn Linux and PHP on.


----------



## Squashman (Apr 4, 2003)

brendandonhu said:


> Mandrake has a checkbox during the install, you just have to click it to install server packages.
> And you will still need to learn Linux, or your server WILL get hacked.
> 
> http://tldp.org/LDP/intro-linux/html/intro-linux.html
> ...


YEP! And unsecured & unpatched Linux box is just as bad as a Fully patched Windows box!


----------



## Alex Ethridge (Apr 10, 2000)

Please don't derail this thread with off-topic comments.

My project involves a stand-alone box as has been clearly stated above and security is not an issue I need to address in this thread.


----------



## EtHeO (Jul 19, 2005)

Alex Ethridge said:


> Thanks for the links.I remember several check-boxes there--which boxes--which components?This will not be employed as a web server. It's just for me to learn Linux and PHP on.


Still, you should check the boxes Webserver and Database server. They are Apache, PHP and MySQL.


----------



## Alex Ethridge (Apr 10, 2000)

Thanks. That's what I needed to know.


----------



## Squashman (Apr 4, 2003)

Alex Ethridge said:


> Thanks for the links.I remember several check-boxes there--which boxes--which components?This will not be employed as a web server. It's just for me to learn Linux and PHP on.


What't the point of learning PHP if you are not going to test the scripts on a Web Server. Granted you can run the scripts from the command line and such but most people learn PHP to program for the web.


----------



## Alex Ethridge (Apr 10, 2000)

Your post looks like a rhetorical question; but, I will answer it as though it weren't.

You've missed the point of setting up this box. It is for testing scripts for errors and accuracy without having to upload them to the web to do so.

One law of science is that when conditions change, results are likely to change. I am attempting to create conditions here as close as possible to web conditions, for testing my scripts. This increases the possibility my scripts will work as intended when they do get to the web. And, it will save time and inconvenience in that I don't have to suffer the inconveniences and delays involved in hundreds of uploads to the web just for testing. I can do all my development and testing right here on the same machine. I also save money because I don't have the expense of a web site until my site is completely developed, which could take months; I'm not in a hurry.


----------



## Alex Ethridge (Apr 10, 2000)

*askrieger,*

I just looked at the manual you linked. I think it is worth a print and binding.

*EtHeO,*

PHP wasn't a choice during the setup; Perl was. I guess I can run that one down on the web somewhere.


----------



## Squashman (Apr 4, 2003)

How are you planning on testing you scripts and Web Development without making your Linux box into a Web Server. If you are doing web development and need to test PHP scripts, you will need to install Apache and PHP on your Linux box. You are not incurring any costs by doing this. Nobody said anything about you having to incur any costs for anything or upload your files to test them. Not sure where I implied that in a previous post. If you make your linux box into a web server by installing Apache you have spent $0.


----------



## Alex Ethridge (Apr 10, 2000)

In *EtHeO's* third post, he made those suggestions. In my post just under that, I thanked him and stated that was what I needed to know.

I installed Web Server and everything else I could find in the Mandrake installation options that was relevant to running PHP. Anything not available in the installation will be added later.

Frankly, with my very limited (almost no) knowledge of Linux, I don't even know how to check to see what was or wasn't actually installed at this point. I'll just have to trust that the selections I made were actually executed.


----------



## brendandonhu (Jul 8, 2002)

Squashman said:


> How are you planning on testing you scripts and Web Development without making your Linux box into a Web Server. If you are doing web development and need to test PHP scripts, you will need to install Apache and PHP on your Linux box. You are not incurring any costs by doing this. Nobody said anything about you having to incur any costs for anything or upload your files to test them. Not sure where I implied that in a previous post. If you make your linux box into a web server by installing Apache you have spent $0.


He DID install Apache and PHP. He's only saying security isn't important for the webserver as it won't be online.


----------



## Squashman (Apr 4, 2003)

brendandonhu said:


> He DID install Apache and PHP. He's only saying security isn't important for the webserver as it won't be online.


I wasn't responding to that.

He said he didn't want to make his linux computer into a Web Server yet he wanted to do web development with PHP. I was just wondering how he was going to accomplish this task without making his computer into a Web Server.

Enough said. I understand where he was coming from and I think he understand where I was coming from.


----------



## jiml8 (Jul 3, 2005)

You need to install Apache, PHP, and MySQL. Don't worry about securing it initially; just put it behind a router appliance that you can pick up at any computer store. That'll block it from the internet and make it safe for you to use for testing. As you learn how to configure apache you can secure it then expose it to the net if you wish.

Beyond that, be aware that PHP is not well standardized; just because it runs on your box doesn't mean you won't have to debug on the server. Make sure you turn off most global PHP options on your box; all servers connected to the net will have turned them off and how things work will vary according to this.


----------



## brendandonhu (Jul 8, 2002)

What?? PHP will run the same on all systems


----------



## jiml8 (Jul 3, 2005)

brendandonhu said:


> What?? PHP will run the same on all systems


No it won't. There are significant version (and configuration) differences.

Been there. Done that. Got the arrows sticking out of my butt.


----------



## EtHeO (Jul 19, 2005)

Squashman said:


> How are you planning on testing you scripts and Web Development without making your Linux box into a Web Server. If you are doing web development and need to test PHP scripts, you will need to install Apache and PHP on your Linux box. You are not incurring any costs by doing this. Nobody said anything about you having to incur any costs for anything or upload your files to test them. Not sure where I implied that in a previous post. If you make your linux box into a web server by installing Apache you have spent $0.


There is a miscommunication here, I believe:
A web server is a server attached to the web, serving everyone who has acces to it, the files they want. An example of a web server is google.com's one. It serves you it's index as soon as you go to google.com.

The option Web Server in mandrake install. It is an option to install apache, I believe with built-in php support (but that is another matter).

Knowing this, you can make a Web Server, without having it have to be a web server. (You install the apache server and other programs, you just don't allow anyone but yourself to access it)


----------



## EtHeO (Jul 19, 2005)

jiml8 said:


> No it won't. There are significant version (and configuration) differences.
> 
> Been there. Done that. Got the arrows sticking out of my butt.


Just felt I had to say this: I Know Your Pain...


----------



## brendandonhu (Jul 8, 2002)

Such as?
I haven't seen any configuration or version problem you can't fix with php.ini


----------



## EtHeO (Jul 19, 2005)

Try lacking functions, different functionality in functions, and of course, *lacking functions*

Don't make me cough up the story of my ftp search engine...


----------



## jiml8 (Jul 3, 2005)

brendandonhu said:


> Such as?
> I haven't seen any configuration or version problem you can't fix with php.ini


I have. Any configuration/version problem that occurs on a web host which you don't own and have only the access they give you - and therefore you can't touch php.ini.


----------



## brendandonhu (Jul 8, 2002)

Lacking functions such as....?
His box is running PHP4, which is compatible with other PHP4 installations, and PHP5.
And he hasn't installed any configure options that standard php doesn't have.

You can create a php.ini in any directory that applies only to your subdirectories, all decent Apache hosts allow this or using the ini_set function to change configs.


----------



## EtHeO (Jul 19, 2005)

Check this link: http://php.net/ChangeLog-5.php and search for "Added", then tell me there are no differences between php versions that can't be bridged by php.ini


----------



## brendandonhu (Jul 8, 2002)

He is running PHP4 on his test box.
PHP5 is backwards compatible.
Anything he writes on his home box WILL work on a normal PHP5 production server, as obviously it won't use PHP5 functions.


----------



## EtHeO (Jul 19, 2005)

Some hosters don't upgrade at all... By the way, the version 5 changelog was just a sample.


----------



## brendandonhu (Jul 8, 2002)

If they didn't upgrade, then both his home box and the production server will be running the same version of PHP.
So what could he possibly write on his test box that won't work on a webhost's server?


----------



## EtHeO (Jul 19, 2005)

The hoster might have a version of PHP that is older than his one. Besides, it might be another build: think mb_string, mysql, gdlib, that sort of thing.


----------



## brendandonhu (Jul 8, 2002)

He's running PHP4...no webhost should be using anything older than PHP4 for any reason. His mysql code will run on any version a host is using. He has neither gdlib nor mbstring installed.


----------



## EtHeO (Jul 19, 2005)

The lib's were only an example. By the way, how do you know that for sure?


----------



## brendandonhu (Jul 8, 2002)

I still haven't seen anything that would run on his box but not a host's production server. Fact is, PHP is very portable & runs just fine on most installations/systems.

I know he doesnt have gdlib or mbstring because they aren't installed by default, and we know from this thread that he used a default installation.


----------



## EtHeO (Jul 19, 2005)

Okay, so maybe he uses mysql (dude, he USES mysql). And there are definately some hosters who do NOT support mysql.


----------



## brendandonhu (Jul 8, 2002)

Mysql support was compiled in php4 by default, and nearly all PHP hosts have a mysql server. If they don't, he can still use his database server, as its installed on his computer.


----------



## EtHeO (Jul 19, 2005)

Hope, PHP5.0 is default built without...


----------



## brendandonhu (Jul 8, 2002)

Nearly all PHP hosts support mysql, and very few hosts are running PHP5 on production servers anyway.


----------



## EtHeO (Jul 19, 2005)

My primary point (with which I will stick): PHP is not portable per definition, not even when ini access is available.
That is the last I have to say about this.


----------



## brendandonhu (Jul 8, 2002)

Uh, ok, my point is that PHP is portable much moreso than many other languages.


----------



## Alex Ethridge (Apr 10, 2000)

It's portable enough for me. If I do ever complete this script, I will run it from a FutureQuest server. They stay up to date there and latest versions and patches are installed stat.


----------



## brendandonhu (Jul 8, 2002)

Its certainly more portable than most compiled languages.


----------



## jiml8 (Jul 3, 2005)

EtHeO said:


> My primary point (with which I will stick): PHP is not portable per definition, not even when ini access is available.
> That is the last I have to say about this.


I'll toss in one more comment, by throwing out a couple of specific examples of standard scripts in PHP 4 that do NOT run on all production servers.

The nms-formmail script runs OK on servers at ICDSoft.com but will fail on servers at GoDaddy and GlobAT.com

Specifically, this line:

$realname =~ tr#a-zA-Z0-9_\-,./'\200-377##dc;

works at ICDSoft and not at the others, though all claim PHP 4.

Also, some sites run a PHP that requires variables to be initialized before being used, while other sites permit variables to first appear as a function argument without prior initialization. I encountered this little detail in a shopping cart program (MidiCART) which was failing on some hosting services because of uninitialized variables.

PHP is not nearly as portable as one would expect. For portability, go Perl.


----------



## Alex Ethridge (Apr 10, 2000)

Personally, I consider hosts like GoDaddy a place for amateurs. I'll be setting this up (if at all) on a professionally-based business-type server.

People like GoDaddy are marketing-centric businesses who use a lot of gimmickry to lure in amateurs and are unable to appeal to the professional because their tactics are so transparent.

My father-in-law had a site there just long enough to tell me about his problems and for me to discover is hosts name.


----------



## jiml8 (Jul 3, 2005)

I signed up for a godaddy site one time, just to try it out. 

I stayed with them for exactly one week, then rehosted elsewhere.

I have not found a correlation between price and quality of service or server performance. The hosting service that gave me the most grief was XO - and that site was NOT cheap. They would make configuration changes without warning that would break my scripts (mostly PHP) and when I queried tech support about the changes I would get no response for days or weeks. I left them too.

I'm actually considering setting up a static IP and hosting all my own stuff...


----------



## Alex Ethridge (Apr 10, 2000)

My experience with www.FutureQuest.net has been exceptional. I'm sure if you give them a try, you will soon forget about hosting it yourself.


----------

