Honesty Rocks! truth rules.

Installing Apache, Mysql And Php On A Linux Machine Looking for a bit of advice...

HOME      >>       Software


As I'm sure a fair number of people know, having to upload your site every time you make a change to it to see if it works is hardly a good use of bandwidth or time. That's why all of the pieces of software in the topic title are available to install locally and allow you to develop your website without going through that hassle, not to mention the fact that it's generally a lot more bug free.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 Xisto/Xisto 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 machineAs 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.


*bump* No one? I could really do with a smidgen of general advice on this, as the ways I've found of doing it so far don't seem to allow the degree of control I want, but are too complex for me to understand. :)


Sorry Mordent....I don't have that much experience in Linux. I use Windows most of the time and Linux sometimes. If you need any help in Windows I can help you. :)


Which Linux distribution are you using? Most distributions have packages available for PHP, Apache and MySQL which can be installed in a couple of clicks or one line on the terminal.


Maybe you are looking for XAMPP:

XAMPP is a free and open source cross-platform web server package, consisting mainly of the Apache HTTP Server, MySQL database, and interpreters for scripts written in the PHP and Perl programming languages.



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 :)


Which Linux distribution are you using? Most distributions have packages available for PHP, Apache and MySQL which can be installed in a couple of clicks or one line on the terminal.

Fedora 10 64-bit, and I suspect it does have a package for all of the above. The only problem comes with trying to configure them to install in the right place, or to be accessible from where I want them to be. I'll explain in a jiffy...


Maybe you are looking for 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 :)

I've had a look at XAMPP (or LAMP, as I assumed it was called. Good to see I've been corrected on that semantic hiccup), and I'll have to say it doesn't look all that bad. The only problem, in my eyes, is that I can't think of a way of setting the "home" directory as shown above. That's the main reason I want to go the long route and try to understand where things are installed. Would you recommend this, or to carry on with having another go at XAMPP?


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...


After downloading simply type in the following commands:


1. Go to a Linux shell and login as the system administrator root:




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.




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:


XAMPP is currently only available as 32 bit application. Please use a 32 bit compatibility library for your system.

Assuming that I don't want to try and find out how to use a 32 bit compatibility library (unless it's the only way to get the above software working), what other options are there available to me?


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...:D


I figured I'd best add a general update of how I'm doing with this little problem, mainly because I'd like a smidgen of help with getting my set up to match my hosted one here (at Xisto - Web Hosting).
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)â¨

While my ability to use Linux is improving, I'm at a slight loss as to how to actually get my setup such that it's nigh on identical to the one at Xisto - Web Hosting. Without touching any configuration files, etc. etc. everything seems great. I tweaked a couple permissions with chmod to let me access the /var/www directory as my standard user (as well as making sure the link I had in my home directory from my last attempt or twelve still worked, which it did).
â¨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 "//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 "//localhost/index.php" in to my browser it works fine. Oddly, it only applied to the very top file, as all subdirectories (such as "//localhost/somedir" opened up "//localhost/somedir/index.php" - which is the index file in that directory, and the following also worked: "//localhost/somedir/"; "//localhost/somedir/index.php"; "//localhost/somedir/index.php/")
â¨What sort of default behaviour do most people expect from typing "//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 Xisto - Web Hosting's as possible...I don't suppose anyone happens to know a way of exporting PHP settings? :P


I would love to have a more in-depth tutorial as well.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.


The best way to match settings is to compare the outputs of the phpinfo function for the Xisto - Web Hosting server and for your local server.

Create a PHP file that contains the following:


Upload one copy to your Xisto - Web Hosting 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.


httpd.conf and a few comments Installing Apache, Mysql And Php On A Linux Machine

I went through a similar process - one issue that caused an enormous amount of frustration - 


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