Forum Moderators: travelin cat

Message Too Old, No Replies

newbie to macs apache problem

mac apache help

         

stevenjm

9:52 am on Jan 8, 2005 (gmt 0)

10+ Year Member



hey,
just bought an old g3 ibook 700mhz that has osx 10.1 on it and downloaded an autoinstaller for appache and php from serverlogistics. Apache seems to be running fine ie I get the correct page at localhost - problem is that I cannot find the directory it is serving it up from anywhere. I have about one hours experience with mac osx and the finder will not index the hardrive for me so I can do a search for apache2. the old apache is easy to find but this one is nowhere to be seen even though it is running - Ive searched manually just about everywhere with no sign of where localhost is being served from.
would really appreciate any help whatsoever. Thanks - yeh I know I'm a mac retard.

stevenjm

11:56 am on Jan 8, 2005 (gmt 0)

10+ Year Member



ok - this is getting more and more confusing. I've managed to open the terminal and open etc/httpd.conf and its set at library/webserver/documents

that directory is where all the old apache stuff is but if I type localhost in the browser the new version apache stuff is coming but I have not a clue from what directory it is being served from.I just cannot find the new apache directory anywhere even though its obviously running or localhost would not serve up the new version apache page.

am I possibly looking at the wrong http.conf file - is it possibly the old one and being overidden by one somewhere else that I'm unaware of?

this stupid sherlock thing will just not index my hardrive properly so I can search.

DerekH

11:09 pm on Jan 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



10.1 is very flaky indeed.

It really is worth spending a little and upgrading to 10.3
You'll find Apache installed and preconfigured.
To put up a website is as simple as placing the HTML in your account's website directory and turning on personal websharing.

I started with 10.1 and it's about as capable as DOS 2...
The upgrade will take away all your problems and it's as stable as anything too.
DerekH

john316

11:43 pm on Jan 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Macintosh HD/Users/you(accountname)/Sites

I have apache on my macs but don't use it, that is the default location on mine.

timster

1:18 am on Jan 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know the following information is true on Mac OS X 10.2 and 10.3, and am pretty sure it's also true on 10.1, but it's been a while.

Localhost is served from the directory:
/Library/WebServer/Documents/

localhost/~<yourusername> is served from:
/Users/<your_user_name>/Sites/

Of course you can always change that in your httpd.conf file, which is at:
/private/etc/httpd/httpd.conf

But yes, definitely consider upgrading your OS X. 10.1 was usable in its day, but 10.3 is much nicer. You might want to make sure the iBook has more than 256 Mb of RAM, and you'll have a nice little system.

stevenjm

5:51 am on Jan 9, 2005 (gmt 0)

10+ Year Member



Thanks heaps guys. I'll make the switch before I give myself any more of a headache. I think the document server needed to be changed in httpd.conf but using pico would not work for me - it refused the save the edited file and chmod was also refused.

Out of curiosity - is the included version of apache,php etc with 10.3 functional enough to use for web developement or does it need upgrading - if so can anyone recomend a good autoinstaller for apache,mysql,php etc that suits 10.3

All this aside though it seems like its got plenty of potential over a windows system - no extra server needed etc and saves waiting for software companies like macromedia , adobe etc to start writing versions for linux - so far with my limited mac experience I'm quite impressed. Perfect solution for my continuous travelling through asia.

btw 400mg ram

timster

5:26 pm on Jan 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The default Apache on 10.3 is Apache/1.3.33 (Darwin), which has been fine for me. If you want PHP or a SQL server, you'll need to install those. That's pretty easy though. Marc Liyanage's binary installers have always worked for me.

One other note: When you upgrade your OS, be sure to install the (free) development tools, which include make, and other things you might need.

jdonnell

7:55 pm on Jan 9, 2005 (gmt 0)

10+ Year Member



The reason you couldn't edit httpd.conf is because you don't have the permisions to do it. use '$ sudo pico httdp.conf'

10.3 comes will php I believe. You just need to enable it in httpd.conf.

I would really suggest learning a little about unix/linux/bsd and the command line. Learn about permissions (chmod), and how the system works in general. For example, you can find all the httpd.conf files by typing this in the terminal. '$ find / -name httpd.conf'

Also, I don't see any reason to install apache over the one that comes with 10.3 unless you need apache2 instead of apache1.3. You probably don't.

whoisgregg

1:17 am on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



10.3 definitely comes with PHP -- I routinely drop testing websites into my powerbooks /Library/WebServer/Documents/ folder and enable Personal Web Sharing and everything just works. :)

Considering that the default install of apache is updated regularly by the Apple Software Updates, I would never replace it with my own install. I'm just not that good at keeping up with security patches to maintain it myself.

BjarneDM

7:56 am on Jan 10, 2005 (gmt 0)

10+ Year Member



stevenjm:
OK - you've downloaded the ServerLogistics versions.

1) ServerLogistics install everything in /Library
2) Serverlogistics supplant the version of Apache 1.3 and PHP that comes with OS X
3) the files found in /etc/httpd/ is for the Apple Apache 1.3 version
4) EVERY file that the ServerLogistics Apache 2.0 uses is in /Library/Apache2
5) ServerLogistics webroot is in /Library/Apache2/htdocs
6) Apple webroot is in /Library/WebServer
7) ServerLogistics configuration files are in /Library/Apache2/conf
8) the Sharing Preference Pane can only be used to (de)activate the Apple Apache 1.3
9) you'll have to install and use the Apache2 preference pane from the ServerLogistics Apache2 package to (de)activate the ServerLogistics Apache 2.0
10) If you want to use the ServerLogistics Apache2 you must have de-activated the Personal Websharing i the Sharing Preferences Pane (simplified answer - it's possible to have both running, but that's for advanced people)
11) If you've turned on the Firewall, you'll have to open for access to Apache2 explicitly. You can just make a new entry in the firewall with the same port numbers as for Personal Websharing.
12) Please note, that the ServerLogistics PHP package is in two parts: the Apache module and the executable. If you just want to mess around with Apache2+PHP you don't need the executable. If you want to use PHP from the Terminal, you'll need the executable too, and make some additional settings in the settings for your shell.

You might take a look at my personal webpages - link in my profile. The pages are in danish, but ought to be understandable for people not too language challenged.

whoisgregg:
The ServerLogistics packages don't replace the Apple Apache 1.3 and PHP. They install in /Library and don't touch ANY of the files Apple uses for their installation of Apache 1.3

whoisgregg

9:15 am on Jan 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Great rundown of the serverlogistics apache install, BjarneDM!

whoisgregg:
The ServerLogistics packages don't replace the Apple Apache 1.3 and PHP.

I realize that. I was using the word "replace" in the context of "in my everyday use" not in the literal sense of existing in my file system. I apologize for the confusion. :)

stevenjm

2:40 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



ok - great. Thanks again guys.
I've got 10.3 installed now and have disabled the server logistics apache2 temporarily by removing its startup file. The apache included with 10.3 is working fine with websharing enabled but php is just not working for me even though the httpd.conf file in etc/httpd is set to load it and documents are in directory set by httpd.conf.
all I,m getting in the browser is raw php code.

I really only want to do this once - am I better off just installing the server logistics full apache and full php with all libs than messing with the apple ones and websharing.I really want php to be fully functional
without having to drop in extra libs as needed.

and if so is it basically just a matter of pointing the document root in httpd.conf to any directory I want?
sorry about all the questions but I'm back off to se asia for 6 months on friday and am desperately trying to get this sorted before I leave.

BjarneDM

6:19 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



stevenjm:
If you are seeing raw php code you either haven't activated the php module or is doing something incorrectly. If I remember correctly, Apple ships Apache Websharing with php turned off. You'll have to activvate by either un-commenting the following lines or adding them if not present in hpptd.conf. If not present you can just tag them to the end of httpd.conf.

LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

You can see the status of these lines and where they are in httpd.conf by executing the following command in Terminal:

cat /etc/httpd/httpd.conf ¦ grep -n php

(note to newbies: the ¦ is the un-broken vertical line - the board messes it up)

Your html filenames will also have to end in .php instead of .html. If you are putting php code in a *.html file it won't get parsed.

Another thing that might foul things up for you is your php start tags. They come in two flavours: '<?' and '<?php'. The first form is called "Short Open Tags", and it's!not! recommended to use these as they might conflict with xml opening tags that look like this : '<?xml'. It's possible to turn off the use of "Short Open Tags" in your php.ini file. I'm not sure whether Apple's Apache actually loads a php.ini file, but you can find out
1) where php looks for it
2) find the default one
3) take a look at how "Short Open Tags" is set

as to 1):
create a file named phpinfo.php in your web root folder with just the following:

<?php phpinfo();?>

Load this file in any browser: [localhost...]
There's an entry at the start of the page that tells you which folder php is looking for it's configuration file in. It's usually /etc or /private/etc

as to 2):
execute the following command:

sudo find / -iname '*php.ini*'

and enter your administrator password when asked for it
The output of this command will be every php.ini file on your system
On my stock 10.3 I've only got this one: /private/etc/php.ini.default and thus actually no php.ini file loaded. If you don't have any you can create one for youself by issuing this command:
cp /private/etc/php.ini.default /private/etc/php.ini

and then edit the /private/etc/php.ini file in an editor.

as to 3)
To see the standard setting for "Short Open Tags" execute the following command:

 cat /private/etc/php.ini.default ¦ sed -n '/70,90/p'

Note: /private/etc and /etc are actually the same as /etc is a link to /private/etc

whoisgregg:
OK - that clears up the confusion ;)
That was why I chose to use 'supplant' instead of 'replace' ;)

[edited by: BjarneDM at 7:09 pm (utc) on Jan. 11, 2005]

BjarneDM

6:30 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



stevenjm:
and if so is it basically just a matter of pointing the document root in httpd.conf to any directory I want?

Yes, but please note that apart from the DocumentRoot (lines 358-364) you'll also have to set it a little further down (lines 385-389ff) to avoid severe problems.

stevenjm

3:28 am on Jan 13, 2005 (gmt 0)

10+ Year Member



BjarneDM
thanks for all that info - it was certainly helpful.
Gave up on the full version install after trying to download it all via dialup from my mothers home.

Mac os apache and php running just fine after a bit of configuration file editing.
Just a couple more questions though - Can I set this websharing so its on permanently, I keep having to restart it every time I shut down and clicking the padlock closed does not help.

Also now moving away from what I assume was the easy part - can anybody give me any advice on what mysql package to install that will run with Mac os apache and php.

I'm sort of hoping that my limited telnet experience will help out once installed but any tips would be much appreciated.

BjarneDM

5:08 am on Jan 13, 2005 (gmt 0)

10+ Year Member



stevenjm:
autostart of Apple Apache:
If it doesn't start automagically, then it seems as if something has gone wrong with this file: /etc/hostconfig. It has to have this line : WEBSERVER=-YES-

php:
you'll need to have MySQL support compiled in in order for php and MySQL to be able to talk to each other. You can see whether this is the case on the phpinfo page; there has to be a parameter like this: '--with-mysql=<path>' under 'Configure Command'. Apple's php doesn't have support for MySQL (along with a lot of other nice things) - and it's also several versions behind the official stable releases.

MySQL:
there are two stable versions: 4.0.23 and 4.1.8. 4.0.23 is the version you'll have to choose if you are using php 4.3.x. You can use both versions of MySQL with php 5.0.x, but 4.1.8 is only fully supported under php 5.0.x. A version of php 5.0.x with full support for MySQL 4.1.8 has the following in phpinfo: '--with-mysql=<path>' '--enable-embedded-mysqli=<path>'

In short:
you'll have to install at least both a new version of php as well as a version of MySQL.

You can go two ways: The Marc Liyanage way - or the ServerLogistics way
[entropy.ch...]
[serverlogistic.com...]

I'll recommend the ServerLogistics way as the packages you get from there are nicely integrated with one another and are the simplest - very much simpler - to administer for newbies. And please do read the included short pdf install manuals. To be quite frank, it's very clear to me that you have skipped reading the install manuals for the ServerLogistic packages - otherwise you wouldn't have asked several of your questions as they are clearly covered in the Apache install manual.

I won't give you support if you go the Marc Liyanage way. Marc has extensive instructions on his pages.

If any of your questions are covered in the ServerLogistics install manuals, you'll just get an RTFM from me in the future.

I've emailed the three ServerLogistics install manuals to you

stevenjm

7:55 am on Jan 13, 2005 (gmt 0)

10+ Year Member



thanks BjarneDM for all your help.
You are correct - installation guide reading has been taking a back seat as they seemed non osx specific in some cases and I've been trying to do a hundred things at once.

I'll have to start from scratch I think and install full version everything so as not to have future problems- mac apache etc is useless to me without mysql support and I do not want to find its lacking something after an exhausting install.

off to cambodia tomorrow so will have plenty of time to peruse guides and will only ask questions that I cannot get an answer to. Thanks again
steve

stevenjm

11:16 am on Jan 19, 2005 (gmt 0)

10+ Year Member



Ok - Am back in Phnom Penh now and things have gotten worse - broadband here is slower than dialup in Australia and will take me about 10 hours to download apache, mysql, and php.

Have access to panther web server disc and am wondering if this is something I can use by doing a minimum install or salvage individual programs off? I do not want to overload my poor little laptop with a full server setup.

Before anybody gives me a lecture on pirated software just let me remind everybody its the free open source aspects of the disc I am interested in only. Or failing this any advice on how I could come by latest php,mysql and apache from within cambodia without spending 10 hours at an internet cafe? - thanks

BjarneDM

5:43 pm on Jan 22, 2005 (gmt 0)

10+ Year Member



You'll have to extract the things with a program like Pacifist.
Mac OS X Server comes with everyting - even both Apache 1.3.x and 2.0.x.

!BUT! none of the versions you can extract off the X Server disks will be up-to-date. Depending on what you want to use it for this might or might not be an issue for you. The version of PHP will be in the 4.3.x range and I don't know what version of MySQL is included. If you are un-lucky it might even be from the 3.23.x series which by now is pretty much discontinued and replaced with the 4.1 series (or at the very least the 4.0.x series).

In my opinion, you'll be best served (pun intended) by suffering through that 10-hour download. But do use a download manager that's able to re-connect and resume. Monica (http://www.blackdiamond.co.za/bdmonica.html) is one such that I'm using to my very great satisfaction. Or you can go for the commandline and use curl or wget (separate install from fink) in Terminal.

If you go for the ServerLogistics solution, you can upgrade it to the very latest versions of everything by following the instructions on my web-site.

stevenjm

6:44 am on Jan 23, 2005 (gmt 0)

10+ Year Member



Thanks for that.
Actually I already suffered the tedious task of a large download from within a phnom penh internet cafe. They load a single connection up with about 20 computers and internet phones so bandwidth is very hard to come by - after numerous midnight sessions with lost connections etc ,and finally a copy of download manager, I finally acheived the impossible and got everything.

Re the apple user guides for php etc on my previous attempts on 10.1 - they were actually missing from the old packages I downloaded so sorry about all the questions.

now have everything up to date and installed and working the best I can with docs provided but have a problem that seems to be php related.

installed php,mysql,apache2 and everyhting seems to be working however I installed 2 different open source packages to test the installation and one has a problem.

Open realty works fine and no database problem however xoops is a different story - has an autoinstall script which reported everything as being ok (paths, database etc) on finishing installation and getting report stating installed correctly tried index page and after some short time get a blank page with no source - no errors reported on screen. Other pages from within xoops work ok but main page is not showing anything.
database seems fine as openrealty is working fine.

am stuck and have gone through docs to no avail - register_globals on (only problem I could find).
any ideas greatly appreciated. Thanks again.

stevenjm

6:52 am on Jan 23, 2005 (gmt 0)

10+ Year Member



just found some comprehensive docs re blank index pages on the xoops website so will give them a good reading - still apreciate any suggestions though.

stevenjm

7:52 am on Jan 25, 2005 (gmt 0)

10+ Year Member



Thanks everybody for your help.
was a xoops related problem - downloaded latest version and smarty template files were named incorrectly - not sure if xoops mistake or download problem but everything else working fine.

server running like a champion but could do with any speed enhancement tips - runs a little slow on heavy pages with database

BjarneDM

12:56 am on Jan 26, 2005 (gmt 0)

10+ Year Member



Well, if you are a little un-satisfied with performance, there's only one way to go: emulate what wikipedia does - wikimedia.org [meta.wikimedia.org]

jamesa

1:06 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just FYI, if Apache is running you can always find the config files by typing httpd -V in the terminal. (If the Apache process is running under another name you would need to type theothername -V)

Also, I just wanted to add that I never needed to reinstall PHP to get MySQL working with it. The first time I compiled from source, the second time I used Fink -- both worked w/o touching PHP.

stevenjm

5:32 am on Jan 28, 2005 (gmt 0)

10+ Year Member



thanks again.

Is it possible theres some conflict going on between apache and mysql servers? on loading pages that use database they can be painfully slow(up to 20 seconds sometimes) and then less than a second at other times.
no errors but painfully slow at times
btw 400 megs ram.

also another possibly stupid question - being new to mac os I cannot get access to .htacces files from within mac osx - the finder will not let me view system files for editing and textedit keeps throwing on an extension everytime I create one.
(finder is set to view all file types but still no joy)

jamesa

6:27 am on Jan 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can view directories that are invisible to the Finder by clicking "Go To Folder" in the Go menu in the Finder, but the best way to edit them is in the terminal.

Just type 'sudo pico filename' or 'sudo vi filename' or 'sudo emacs filename' to edit the file in pico, vi or emacs respectively. It will ask for your administrative password.

Alternatively, you can change the file's permissions. First do 'ls -l filename' to see the existing owner (in case you need to set it back) and then do 'sudo chown username filename' where username is your OS X username.

BjarneDM

1:35 am on Jan 29, 2005 (gmt 0)

10+ Year Member



1) .htaccess
*All* files with a '.' in front of them are hidden from being displayed in Finder by default. Likewise, the Finder won't let you save a file starting with '.'. You can use a tool like TinkerTool - VersionTracker [versiontracker.com] - to switch visibility of system and hidden files on.

2) 400MB RAM
That's probably your problem. The minimum amount of RAM recommended by trade journals and reviewers of Mac OS X to run comfortably in is 512MB RAM. What's most probably happening in you case is that Apache and MySQL has been swapped out to the HardDisk after not being used for some time. Then, when you call upon them to serve your pages they have to be swapped into RAM again. That's what's causing the long response times. The short response times occur when both Apache and MySQL are already loaded into RAM. Consider upgrading your RAM to the max possible in your computer. Look, I bought my TiBook in 2002 and the first thing I ordered the dealer to do was install the max of 1GB RAM. At present Mac OS X 10.3.7 is also using 2GB of HardDisk swap in addition to my 1GB RAM. You can see how much swap disk your computer is using by running this command :

ls -aloF /var/vm

3) editing system files generally
Many of these are owned by root and are not even editable by an administrator without temporarily elevating the rights of the administator by pre-fixing the command with 'sudo' (enter 'man sudo' in Terminal for an explanation). If you need an editor that's aware of these rights and is using a pretty GUI as well as offering a command line interface, I'll recommend BBEdit - VersionTracker [versiontracker.com]. Yes, it's a bit expensive, but most people find it worth the money. TextEdit is normally unable to handle files owned by 'root'. You'll have to start TextEdit with root privilegies; see here - macOSXhints [macosxhints.com] - for information on how to do that. Also, take at look at 'man open' in Terminal.

4) being new
It's not so much being new to Mac OS X that seems to be your problem. It's being new to the whole Unix/Linux concepts of file access rights and user administrating that seems to be at the root of your problems. See my comment #4 in this thread: [webmasterworld.com...] for recommended reading. Look, Mac OS X *deliberately* hides a lot (if not most of) the FreeBSD Unix underpinnings of the system in order to make it easy for the common in-experienced user. What you are presently doing / trying to do is to dwell deep into the Unix parts.

stevenjm

11:56 am on Jan 29, 2005 (gmt 0)

10+ Year Member



thanks again, I thought possibly the ram was a problem also and that disk swap could be an issue but there seems no pattern to the fast/slow - seems totally random.Your probably correct though.

Re the unix/linux - file permissions are quite familiar to me, admit that theres plenty foreign to me though, its just having to use terminal for everything thats a pain - I can't understand why there is no comprehensive GUI from within the mac osx for everything unix related.(or maybe there is?)

have been using terminal but Was sort of hoping to not relearn unix commands after switching to mac os and thought that telnet type access was something I could drop allong with windows(for local developement anyway).
thanks again for all your help - I'm a mile ahead from when this thread first started thanks to all here. :)

BjarneDM

6:00 pm on Jan 29, 2005 (gmt 0)

10+ Year Member



Unix and Mac OS X:
Well, the GUI is actually Terminal. That's!way! ahead of just having a plain 80x40 text screen. And BBEdit can be considered a GUI for all of those Unix text editors like emacs, vi, pico - BBEdit can even execute Unix commands. And TinkerTool can give you the missing interface to the Unix part of the file system in Finder. There are GUI programs that give you various kinds of interfaces to various kinds of Unix commands, but in my opinion it's impossible to do much more than the Terminal + BBEdit style of interface due to the complexity and extremely many ways of interacting with the Unix commands. Monica [versiontracker.com] can be seen a inface to most of the curl command, Web Devil [versiontracker.com] to most of wget. And in AppleScript you have something like Unix shell scripting.