Advertisement

PHP and MySQL setup

Started by June 23, 2004 12:45 PM
8 comments, last by Null and Void 20 years, 7 months ago
I couldn't find any good tutorials for installing these on debian, so I am wondering how to install it so I can start using it for web design. I will not be having my own dedicated linux server( I will most likely get a webhost, might make a server) If anyone can explain this and make it more clear to me that would be great. Thanks
If it's on your own system or any system that gives you proper permissions: "apt-get install mysql-server mysql-client php4 php4-mysql".

Dpkg and Debconf should take care of the little details and possibly ask you about some preferences. PHP has a lot of backwards compatibility settings left enabled that you might need to still disable manually if you don't want to leave them enabled. Excluding the web server and any database setup you need to do, that's about it.

If it's on a web hosting service's system: It's their job. Make sure the list of features that they're providing you includes whatever you need.
Advertisement
So, I don't need to install PHP to program with it? Because with python, you have to install python 2.3 to program with it and run it. Is it the same with PHP ?
Quote:
Original post by HTML
So, I don't need to install PHP to program with it? Because with python, you have to install python 2.3 to program with it and run it. Is it the same with PHP?

Yes, PHP must be installed to use it. Installation of PHP 4 is in apt-get invocation I suggested. Only an Apache 1.3 module is included in that package, but php4-cgi includes a standalone executable and libapache2-mod-php4 includes an Apache 2.x module.
apt-get install mysql-server mysql-client php4 php4-mysql

I don't need mysql-server if I am just programming with it, right? That goes on my dedicated server or webhost.


And do most internet service providers let you make your own server? ( I am sure they probably care about how much bandwidth you use when people visit your site)


And how do you test PHP to make sure your code works ok if you arn't running the server yet? (like with html you can run it in a web browser.)


I am also using CSS and HTML if you needed to know. Maybe some &#106avascript too for making the sites.
Right, to administrate a MySQL server remotely you don't need the server installed. You may or may not need the client, depending upon how the server is setup. You can connect with SSH and use the administration tools on the other machine or the MySQL port might be left open to you and you can use the administration tools on your own machine; good hardening procedure might make the latter option too annoying for a hosting company to safely make available.

The easiest way to test your PHP pages is to do it on your own machine. In Debian, installing PHP and Apache and probably then using mod_userdir (enabled by default) is the easiest way to test out your PHP scripts (for mod_userdir: place files in "~/public_html" and access them in "http://localhost/~USERNAME"). If that were not an easy option for whatever reason, the functionality can largely be imitated by invoking PHP directly and piping the output into some file you view in a browser.
Advertisement
Thanks. A few things I am still not so sure about


Quote:
Original post by Null and Void
You can connect with SSH and use the administration tools on the other machine or the MySQL port might be left open to you and you can use the administration tools on your own machine;


Happen to have a link to a guide on setting up a server to use MySQL and SSH? I am a newbie to linux and servers, so I am not even sure what SSH is. I thought it was something like secure server something.

Setting up a Red Hat Server Is this a good guide? I used to have a good one from a forum with someone that had a BSD avatar, but I forgot what the forums were called and lost it.

Quote:

good hardening procedure might make the latter option too annoying for a hosting company to safely make available.


huh?

Quote:

(for mod_userdir: place files in "~/public_html" and access them in "http://localhost/~USERNAME").


Not exactly sure what you mean here. Are those filenames made by default or would this be my server. Sorry I don't have much knoledge of servers.

Quote:

.. can largely be imitated by invoking PHP directly and piping the output into some file you view in a browser.


Like an HTML file? This seems a lot easier to do than the other way. Is there an advantage with the other way over doing this?


If you know of any good tutorials or anything for this stuff, let me know.

Thanks again.
Quote:
Original post by HTML
Happen to have a link to a guide on setting up a server to use MySQL and SSH? I am a newbie to linux and servers, so I am not even sure what SSH is. I thought it was something like secure server something.

SSH is easy: "apt-get install ssh". If you're just using password authentication, you can then connect to the machine running SSH (as long as no firewall or NAT is in the way) and type in your user name (or any other user name that is valid on the machine) and the respective password. Most often, SSH is used to just provide a terminal running on the serving machine to the client machine. You can also forward X sessions through SSH for securely using X over any network.

Quote:
Original post by HTML
Setting up a Red Hat Server Is this a good guide? I used to have a good one from a forum with someone that had a BSD avatar, but I forgot what the forums were called and lost it.

I don't have time to read it right now. Most of it seems like it is unnecessary for you to do directly with the help Debian gives you built into Dpkg and Debconf.

Quote:
Original post by HTML
Quote:

good hardening procedure might make the latter option too annoying for a hosting company to safely make available.

huh?

A hosting company (or whatever) may disable remote connections to any databases running on their systems to make them more secure (or, they may not). They could, if they wanted to, provide only one or more specific static IP addresses access to that port and retain most of the benefits of firewalling the port, but they probably wouldn't want to bother.

Quote:
Original post by HTML
Not exactly sure what you mean here. Are those filenames made by default or would this be my server. Sorry I don't have much knoledge of servers.

On the system running Apache with mod_userdir (which would probably be your own system if you were just trying to test your PHP scripts), you could create a directory in a user's home directory (the current user's home directory is traditionally aliased as "~") called (by default) "public_html" (hence, "~/public_html") and place PHP and other files in it for Apache to serve. To access a user's (e.g., a user named "HTML") own public directory from the serving machine you would access the URL "http://localhost/~HTML".

Quote:
Original post by HTML
Like an HTML file? This seems a lot easier to do than the other way. Is there an advantage with the other way over doing this?

If you don't mind the annoyance of having to run PHP manually often and some possible file naming issues (your web page might reference "something.php" but you need it to go to the manually interpretted output at "something.html"), it's good enough for testing.

I honestly don't considering installing Apache and PHP once to be more difficult. Up to you :).

Quote:
Original post by HTML
If you know of any good tutorials or anything for this stuff, let me know.

Debian does all of the installation work for you. The MySQL documentation would be helpful for doing whatever you need to with MySQL post-installation though. Likewise, PHP's documentation will certainly make development in PHP easier if you're not experienced with it yet.
Thanks. That helps a lot. Just one more question.

Would you prefer hosting your own site over getting a webhost or vice versa? I would think having your own server for free would be a good thing, but I am not sure about the security issues.
Quote:
Original post by HTML
Would you prefer hosting your own site over getting a webhost or vice versa? I would think having your own server for free would be a good thing, but I am not sure about the security issues.

I think it depends if uptime or security is more important. A good hosting service can likely better uptime with their staff, uninteruptable power sources, and generators. With a dedicated system (either at a more expensive hosting service or at your own home or office), one can potentially customize the system in many ways to make it much more secure. Physical security (e.g., matters that deal with someone coming in a window and stealing a HDD :P) may or may not be important and may or may not be better at a hosting service's server farm (the comparison depends on where you'd keep the machine and whether or not you'd be using a good hosting service). Encrypting the entire HDD and properly locking down the hardware (a BIOS password and secured boot loader if nothing else) make physical security a little less vital for the data's safety but no less important for uptime.

(For Linux, look into the Linux 2.6 kernel for a better whole-partition encryption method than what exists in 2.4 unpatched, dm-crypt. A bit more robust and a bit more cryptographically sound; the latter is based on what I've read only.)

This topic is closed to new replies.

Advertisement