Enabling PHP on Panther

PowerMacX

Registered
Hi, I can't seem to make PHP active on Panther! I edited httpd.conf in the right places, but still no luck! The thing is, Apache says that the PHP module is loaded and running, but all my php pages show as source!

Any ideas?
Thanks!
 
PowerMacX said:
Any ideas?
Thanks!

Do you have a line such as:

AddType application/x-httpd-php .php

in your httpd.conf?

If you files end .php3 you'll need to add that on the end as well

AddType application/x-httpd-php .php .php3
 
Do you have a line such as: AddType application/x-httpd-php .php

Yes, I suspect that there may be a problem with directory permissions or something like that, still, no idea :(
 
PowerMacX said:
Yes, I suspect that there may be a problem with directory permissions or something like that, still, no idea :(

Directory perms shouldn't cause source to show.. This is a silly question but you have restarted apache haven't you? :)

It's always the simple things you over look :)
 
I'm assuming you're running the version of php that comes with Panther?

If I'm right, you might want to install a a better and more feature-rich version.

For starters, you get more modules as part of the standard package, and in true mac style, it's a double-clickable installer.

What more could a php fiend want?..
 
oRiCN said:
Directory perms shouldn't cause source to show.. This is a silly question but you have restarted apache haven't you? :)

It's always the simple things you over look :)

Yes, I restarted it in about 10 differen ways :) (System Prefs, apachectl, kill, restart, etc, etc)

I'm assuming you're running the version of php that comes with Panther? If I'm right, you might want to install a a better and more feature-rich version.

For starters, you get more modules as part of the standard package, and in true mac style, it's a double-clickable installer.

What more could a php fiend want?..

Downloading right now :D
I didn't know that Marc already had a Panther version up! Thanks!
 
In /etc/httpd/httpd.conf you uncommented these lines?

LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c



If so, you probably also need to add script executing permissions to your user directory. Try adding an "Options All" to your directory and see if that works.
 
btoth said:
In /etc/httpd/httpd.conf you uncommented these lines?

LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c



If so, you probably also need to add script executing permissions to your user directory. Try adding an "Options All" to your directory and see if that works.

Yes, I played around with that (Options), but no luck. I'm going to create a new user and start again from scratch to see if I messed up. :(
Thanks everybody!
 
PowerMacX said:
I didn't know that Marc already had a Panther version up! Thanks!

Caution! If you're planning on installing MySQL as well, be careful.

He does have the binaries, but the instructions are little misleading.

If you follow some of them, you're likely to mess up the install.

I'd go onto the forum and have a good look around before going to the command line...
 
It's a little strange that you don't have PHP enabled on Panther, since it is by default.

So, when you visit a PHP page you see the source, right ? How is the file named ? What commands are you using ? What does the code look like exactly ? Are you sure you didn't accidentally mis-type the PHP opening tag ?

And as for MySQL, there are Mac OS X binary packages available from mysql.com, and those are the onesI trust.
 
I can verify that php isn't working for me too. I uncommented the three DSO lines that should enable php, and once you do that the default httpd.conf should take care of everything else with this directive
<IfModule mod_php4.c>
# If php is turned on, we repsect .php and .phps files.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

# Since most users will want index.php to work we
# also automatically enable index.php
<IfModule mod_dir.c>
DirectoryIndex index.html index.php
</IfModule>
</IfModule>
but just in case I put a .htaccess into the one directory that I'm going to be executing php files from:
DirectoryIndex index index.html index.php
AddType application/x-httpd-php .php .html .htm
DefaultType application/x-httpd-php
php_value auto_prepend_file /refer.php
I don't know what that last line means, but it comes with a package that I'm trying to get working, but it isnt.
Here is what the source of a php page looks like:
<script language="php">
phpinfo();
</script>
Anyone see anything wrong with my config? I can't figure this out, and am working with a mostly standard httpd.conf.
 
OK, just to make sure I wasn't forgetting something I replaced my httpd.conf (under OS 10.3.2) with the contents of httpd.conf.default. Then turned Apache off the on again. This reset everything to the default settings and my PHP source got dumped when I accessed it from my user directory.

I went into httpd.conf with BBEdit and removed the comment (#) from these two lines only:

(239) LoadModule php4_module libexec/httpd/libphp4.so
(282) AddModule mod_php4.c


I left everything else at the defaults. After turning Apache off then on again my PHP script worked just fine:

<?php
phpinfo();
?>



So that should be all that's needed to get PHP working under Panther (or Jaguar for that matter). Maybe the problem lies in using the <script language="..."> method (though I know it shouldn't). Maybe your php.ini is the root of your problems?



*edit*

Also, if you're trying to use an .htaccess file to override settings and it doesn't seem to be working... that option must be turned on either globaly or specifically for the directory(s) that you want to allow .htaccess for. I believe it's the AllowOverride directive.
 
Hey, here's another good question, how are you trying to view the files? If you look at the through your browser and the URL says something like "file:///path/to/file.php" then all you're going to get is source. You have to actually parse the PHP by going through "http://localhost/". Add ~yourusername to the end of that link and you will get the index page for your user account's Sites folder.
 
I seem to have figured out the problem, and it's just a safari caching issue. I guess I could go and delete my safari cache, but the php works just fine in mozilla. I've been having some trouble with safari caching things funny and having to force reloads of pages, it's getting annoying.
 
mr. k said:
I seem to have figured out the problem, and it's just a safari caching issue. I guess I could go and delete my safari cache, but the php works just fine in mozilla. I've been having some trouble with safari caching things funny and having to force reloads of pages, it's getting annoying.

Yeah the latest Safari caches really strangely. I had my domian unpointed (by the DNS by accident) and after that my site would never load properly, though the DNS was corrected. I had to empty the cache -- stupid :p
 
Another somewhat related problem, I don't really want to start a new thread. But would serving everything as application/xhtml+xml get in the way of my DefaultIndex declaration in apache? I have Default index set to redirect to index (no suffix) index.html and index.php, but whenever I type the url of a directory it's index page never loads and I get a blank page with no source that is served as application/xhtml+xml (in mozilla, which as far as I know is the only browser that will call for xhtml to be served correctly in its accept headers).
I can't troubleshoot the problem very well. Also could serving pages as application/xhtml+xml get in the way of them having my ssi parsed? Safari parses the ssi in my pages, but mozilla doesn't.
Best new feature in safari: Debug -> Open Page With -> [list of all browsers on your machine]. This is so awesome for cross browser testing!
Update: I think that my DirectoryIndex problem is Safari specific -- weird.
 
Back
Top