PHP4 what am I doing stupidly?

Gwailo

B.A. Economics (Hon)
I followed the installation instructions given in the FAQ board, which are the sames ones I read on entropy, and they don't work.

Either my browser give me the 'I don't know what to do with a .php file' message, or I get a blank page for the (properly spaced) code:

< HTML >
< ?php phpinfo() ? >
< /HTML >

So what's going on here? Any help would be greatly appreciated...
 
That's what I meant by "properly spaced" but when I previewed the post without the spaces, it parsed the HTML and it disappeared in the message, so I added the spaces.

But I still can't catch what I mucked up in httpd.conf (assuming the problem's there).
 
First make sure you have php turned on in httpd.conf.

Then make sure you have set up apache in httpd.conf to run files with the .php extension.

Then make sure that the .php file is in your sites directory.

Then re-start the apache webserver.

Finally, try out the .php file on or the .html file that has the code embedded in your browser by entering:

http://localhost/~username/target.php

Of course replace the ~username with your username and the target.php with the filename of the target file. The target file must be located in your Sites directory to work this way.

I know these steps sound simple, but I've found you got to follow them all and you have to especially make sure you have php turned on correctly because it is not set up in the httpd.conf file by default.

Hope this helps.

SA:)
 
Thanks buc99, but I already checked that. The file is hosted from

/Library/WebServer/test.php
http://65.94.189.23:8080/test.php

So you can see for yourselves what the problem is. I checked to see if it would magically work if placed in my /users/gwailo/sites folder, and it doesn't.

The following lines are from my httpd.conf file, did I much that up (lines numbers in brackets):

(239) LoadModule php4_module libexec/httpd/libphp4.so
(281) AddModule mod_php4.c
(858) AddType application/x-httpd-php4 .php
(859) AddType application/x-httpd-php4-source .phps
 
Also, libphp4.so is located in /usr/libexec/httpd and is owned by myself (gwailo/staff) could this cause the problem? I doubted it because root starts httpd for port 80, which is what it's running on (the :8080 is thru my NAT).
 
nope, my test.php file has just

&lt;?PHP phpinfo() ?&gt;

No HTML tags, no semicolon, no nuthin, and works just fine
 
Just trying to let you knw the right way to do it. In case you run into problems in the future. Which you will, if you add more lines to that, that's all.
 
You about got me here. I tried a web page just like you were trying. I had no problems. I made sure Apache was doing everything you said. No problems. You can try switching apache over to port 80, but port forwarding shouldn't cause a problem. It does not matter that libphp4.so is located in /usr/libexec/httpd, that is where it supposed to be. You did uncomment the appropriate php linese in httpd.conf? Just double checking. When I tried the link you posted, I got a message from explorer asking me what to do with the file because it could not handle the app. Tey removing everything from the file except for the php code and then run it again. You didn't make the file executable did you? I do not believe you make php files executable like cgi files. I know I can run php files in my browser whithout setting the permissions to make it executable. So I'm going on that assumption since I'm not an expert php coder. Someone else may be able to clarify this for you if you don't already know. Anyways, if you did make the php file executable, try a read only php file and see how it works. Also try running another php file, there are plenty located in the Library directory. If all else fails, you may have installed something wrong. Try the following website for tips on installing php:
http://www.entropy.ch/software/macosx/php/

I've followed this guys directions on everything and have had no problems. Also what developer tools did you use to build? I've heard that people building apps with the wrong developer tools for their system were having troubles. Just grasping for straws now.

Good Luck.:)
SA
 
putamare, nice tagline.

Yeah I also get the application handler window when I try the new code, WITH the semicolon (how embarassing! thanks for that) and still get the silly window. The MIME type is that listed in httpd.conf, so it should be handled correctly.

As for making the file exectuable, I haven't done anything special to it.

Does anyone know of a place I can get a backup/clean or rebuild my httpd.conf file? I think I may have scrwed it up somewhere along the way. I notice seveal backups in the same folder, but they're likely generated on restart and I'm apachectl graceful'ed it many times.

That's why it confused me so much, because I followed installation on my old iMac for PHP in 10.1.3 and it worked PERFECTLY from the get-go and I've pretty much duplicated my steps (minus the httpd.conf manual edits, I just followed entropy installation and it was fine.)

Thanks for all the help though so far, most appreciated!!! Even though it still won't work eheh!! :p
 
Did you install Apple's security update after the php install? Maybe an update would help, but I dobut it. My phpinfo worked after the Security Update, it just didn't have any of the cool libraries.

I stole my tagline from Despair Inc. It's perfrect for:
- Survior Types
-Dorks who quote Nietzsche
-Disaffected college students
 
You ought to be able to download the apache source and find a httpd.conf file in it. I don't think there is anything wrong with the backup conf files though. They should be pristine. I could be wrong, but compare them side by side with your conf file and see where it went wrong.

Good Luck.
SA:)
 
I've done everything right and now i get this when php is activated

dyld: /usr/sbin/httpd multiple definitions of symbol _XML_DefaultCurrent
/usr/sbin/httpd definition of _XML_DefaultCurrent
/System/Library/Apache/Modules/libphp4.so definition of _XML_DefaultCurrent


What can i do to fix that

Thanks a lot for the one that can give me answer
 
Originally posted by buc99
You ought to be able to download the apache source and find a httpd.conf file in it.
Or look for httpd.conf.bak in the same folder as your garbled httpd.conf file.

Bernie :eek:)
 
Back
Top