| |
|
Welcome to KnowledgeSutra - Dear Guest | |
Installing Apache, Mysql And Php On A Linux Machine
#1
Posted 20 December 2008 - 01:44 PM
Now, for those of us who are a bit new to Linux (me included, although I'm gradually getting a little more confident as time goes on), installing all of this in the correct manner on a local machine is a bit of a daunting task. There are 101 ways of doing it, as far I can tell, and the one way I intend to avoid is with the installation of LAMP (or whatever you call it) or similar. as I generally consider these options as "messy" (do feel free to try to change my mind, though).
My main concerns are twofold: firstly, I want to have the setup as close to those on AstaHost/Trap17 as possible (i.e. all PHP scripts behave the same way, etc.), as that is where I'll be hosting my sites so naturally I want to get an accurate testing area for the site development up and running. My second concern is the location of the software. Naturally I want easy access to it, but would rather it be, again, in more of a similar setup to that which is given by the hosting. This is likely best illustrated with a little diagram...
/home/myhostinguser <- this is my "home" folder on the hosting server
/home/mylocaluser/projects/web <- this is where I want the "equivalent" folder to be on my local machine
As a little side note, does anyone know whether you are able to use the same hosting folder (/home/myhostinguser) for multiple hosting plans, whether you have to use a different one or have to use the same one, or in fact can do either?
Thanks in advance to any and all who give advice, be assured I appreciate anything you have to offer.
#5
Posted 22 December 2008 - 11:36 AM
Quote
I use it regularly to test my scripts locally without bothering with FTP and it's quite good and easy to install even for complete newbies. You can find the instructions here.
Have fun
#6
Posted 22 December 2008 - 12:41 PM
rvalkass, on Dec 22 2008, 08:56 AM, said:
miladinoski, on Dec 22 2008, 11:36 AM, said:
http://en.wikipedia.org/wiki/XAMPP
I use it regularly to test my scripts locally without bothering with FTP and it's quite good and easy to install even for complete newbies. You can find the instructions here.
Have fun
On a different side note, assuming that I do find a way of installing Apache, MySQL and PHP all on my local machine, how would you recommend I try to configure it such that anything I use it for would behave identically to the way Xisto hosting does things. I'm going to hazard a guess it's something to do with INI files, but haven't a clue where to start...
Anyway, one option I've considered is the use of links. I've no idea how they work, nor if they're indeed the sort of thing I'm after, but being new at Linux means I have something else to go have a look at. My understanding of links is that you can create a Windows-esque shortcut of a folder in another directory. The difference is, by opening the link you can alter the files, but they have a path of the link's directory. Is this correct? Let me try to explain it better...
Let's say I have all of my local server-y stuff installed, so that I have a www directory sitting in a directory called /a/b/c (i.e. /a/b/c/www). If I create a link to this directory (the www one) and place it in a directory called /x/y/z (i.e. /x/y/z/www), and open up this link, is it true that any changes I make to either directory or link will affect the other, and that each has a separate hierarchy, or whatever you want to call it? This is all slightly off topic, but as it's trying to accomplish what I want I don't see why I can't digress slightly.
Thanks to all those who have posted so far!
EDIT: Drat...an update for you folks, then:
After reading through the XAMPP page, and finding this little snippet...
Quote
1. Go to a Linux shell and login as the system administrator root:
su
2. Extract the downloaded archive file to /opt:
tar xvfz xampp-linux-1.7.tar.gz -C /opt
Warning: Please use only this command to install XAMPP. DON'T use any Microsoft Windows tools to extract the archive, it won't work.
Warning 2: already installed XAMPP versions get overwritten by this command.
That's all. XAMPP is now installed below the /opt/lampp directory.
*snip*
To start XAMPP simply call this command:
/opt/lampp/lampp start
...I decided to give it a go. I downloaded the archive, and ran the following commands from my shell:
su <give password> cd <dir of downloaded archive> tar xvfz xampp-linux-1.7.tar.gx -C /home/<my local username>/projects/website/lampp [wait for it to extract] cd /home/<my local username>/projects/website/lampp ./lampp start
I get the following message:
Quote
EDIT 2: Hmmm...so I gave up on XAMPP for now, and instead went for the approach of installing the Apache (i.e. httpd), MySQL and PHP packages separately in the Add/Remove Software option in System -> Administration. After that I played around with permissions and links for a bit, until I had a link to the www directory sitting in my user's home directory that I could use. So...now the dilemma about getting it to actually parse my PHP files...
Edited by Mordent, 22 December 2008 - 08:12 PM.
#7
Posted 03 January 2009 - 04:00 PM
So, after faffing around with XAMPP, removing that and trying to install Apache, MySQL and PHP separately (I got bogged down in God only knows what trying to get that to work, so I gave up), removing that and then installing the three separate ones from the Add/Remove Software option (i.e. using preconfigured packages), I found the last to be the most successful to date.
What I currently have installed (and obviously the relevant dependency packages):
- php-5.2.6-5 (x86_64)
- httpd-2.2.10-2 (x86_64) - i.e. Apache
- mysql-5.0.67-2.fc10 (x86_64)
I then opened up a console, changed to my root user and started up Apache (i.e. as root "httpd"). I didn't get any message that anything had worked, but I guess I didn't get any errors either, so I suppose that's alright. Now, after that I had the slight issue of trying to work out why "http://localhost/" didn't default to showing the index file (index.php, which contained the phpinfo(); command), nor show any directory listings. This is still a minor, if irritating issue, but by typing "http://localhost/index.php" in to my browser it works fine. Oddly, it only applied to the very top file, as all subdirectories (such as "http://localhost/somedir" opened up "http://localhost/somedir/index.php" - which is the index file in that directory, and the following also worked: "http://localhost/somedir/"; "http://localhost/somedir/index.php"; "http://localhost/somedir/index.php/")
What sort of default behaviour do most people expect from typing "http://localhost/" in to their browser address bar? Anyway...aside from that little query, I'm back to trying to get my configuration such that most scripts I develop locally perform the same when uploaded. In essence, I'd imagine this has to do with the php.ini file? Has anyone else tried to do this, or had any success? I know that my default setup differs from the one in my hosting plan, as, for instance, magic quotes are on in one and off in the other.
Thanks for any help!
EDIT: So, I feel a bit slow...seems all I needed to do was to restart Apache ("httpd -k restart") and the whole localhost not showing problem went away. I also had to remove the welcome message, at least for now, to make sure that the page index was showing fine (/etc/httpd/conf.d/welcome.conf, follow instructions in the file), but as they seemed fine I removed my changes and everything seems awesome...now to try to get my build as close to ComputingHost's as possible...I don't suppose anyone happens to know a way of exporting PHP settings?
Edited by Mordent, 04 January 2009 - 12:51 AM.
#8
Posted 04 January 2009 - 08:33 PM
Something from the beginning to end type of thing. I am 100% a Linux newbie, but am looking into getting a VPS...And honestly I don't even know where to start regarding getting a web server set up or anything,=/. Or even how to install programs.
#9
Posted 05 January 2009 - 09:54 AM
Create a PHP file that contains the following:
<?php phpinfo(); ?>
Upload one copy to your ComputingHost account, and the other to your local server. Open them both in a web browser and compare the differences. Most can be changed using the configuration file php.ini, which is fairly self explanatory. However, if you spot a difference you don't know how to correct then let us know and we will do our best to get a solution.
#10
Posted 29 April 2009 - 12:59 AM
I went through a similar process - one issue that caused an enormous amount of frustration -
httpd.Conf
On my virtual server, all of the virtual host - and everything else created by the control panel - are located in separate files in the conf.D directory under httpd directory. Editing the httpd.Conf file was futile!
If you are learning dedicated web hosting and are working on anything 'useful' I recommend either a dual-boot or a dedicated linux machine at home or office. It is pretty easy to 'mess up' a server if you don't know what you are doing. Generally it can be resurrected, but down time is not good. I did have to 'reprovision' (reformat) it once and was out of email (and company web sites) for 3 days. Some hosts charge for this. Mine does not, but the customer service is non-existant (go . . . Something).
I set up a local server for my company using a 10 year old pentium 3 box with 512 mb - and it works well (and even works fine for web browsing). Our last win98 machine with a new life!s
I'm also enjoying the use of linux on some of my home computers - I'm setting up an htpc (currently ubuntu) I have an office computer running primarily fedora (to mimic my dedicated server) and I'm writing this on a laptop using a live CD install of linux mint (which might replace my ubuntu installations).
Now I test out wordpress and joomla installations and changes before uploading (and have running local backups)
Except for photoshop/lightroom and large format printing, my macpro is getting neglectged . . . (and windoze is being completely avoided)
-reply by kevin
Reply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users















