Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Getting PHP to work

Getting PHP to work
Thread Tools
tr909
Fresh-Faced Recruit
Join Date: Oct 1999
Location: NL
Status: Offline
Reply With Quote
Mar 26, 2001, 09:37 AM
 
I got some emails asking how to install PHP here is what i anwsered:

Ok, to install PHP you have to do the following, first
be sure that you are in the terminal and that you have root
rights (you can type 'whoami' and it has to say 'root')
if you don't know how to get root rights then mail me.

go to the directory where you unstuffed (GZ and TAR) the
php-4.04l1 distribution files and type the following commands (each one will take a few minutes):

# ./configure --with-mysql --with-apxs
# make
# make install

(only) then copy php.ini-dist to /usr/local/lib/php.ini
and then you have to edit apache config

/private/etc/httpd/httpd.conf

i think it was around line 819 where you have to UNcomment

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

and around line 240 be sure that the next is available:

LoadModule php4_module libexec/httpd/libphp4.so

and around line 280 there is:

AddModule mod_php4.c


also i found that around line 356 be sure to give a servername because in my situation the user directories didn't work (http://192.168.0.10/~username tries to connect to http://localhost/~username which doesn't work if you try to connect from another computer) if your computer doesn't have a REAL internet name (like www.apple.com) use your IP number:

ServerName 192.168.0.10

Once you have made these changes and saved the file, you should be ready to restart your server and try it out. in the terminal type:

# apachectl restart

Create a test file named test.php in your web tree somewhere and put some test PHP tags in it. <?phpinfo()?> is a good first test. This tag tells PHP to do a braindump and tells you all sorts of things about itself.

********** ALSO READ THE "INSTALL" FILE *************

you're now in PHP business.

Regards,
tr909

ps. From what i read in other topics, if you try
to enable the 'shipped with MacOS-x version of' php that it
won't work.. (but i didn't try). perfectly understandable
since Apple might have other priorities to work on for the
shipping macOS-X.

ps2.
I found info on the PEAR error at the end of the compile,
it was far, far away in the forums i'm no UNIX diehard so
i don't know how serious this is: http://forums.macnn.com/cgi-bin/Foru...ML/000327.html
snippet:
| PEAR still doesn't build due to a problem with HFS(+)
| not storing pear and PEAR as different files...
| But this is a minor issue, and if someone with OS X on
| UFS built it, it should work...


[This message has been edited by tr909 (edited 03-26-2001).]
--- tr909 webdesign ---
     
gdif
Fresh-Faced Recruit
Join Date: Mar 2001
Status: Offline
Reply With Quote
Mar 26, 2001, 10:23 AM
 
This is a pretty tough problem at the moment. It occurs in the "make install" phase near the end and prevents completion. To get around it you have to add --disable-pear to the config so it was:

./configure --with-mysql --with-apxs --disable-pear

It disables the pear routines but all seems to still work.

This is only applicable to work on the HFS+ file system. You won't need to do this if you are on a UFS filesystem.

--gdif
     
tr909  (op)
Fresh-Faced Recruit
Join Date: Oct 1999
Location: NL
Status: Offline
Reply With Quote
Mar 26, 2001, 10:55 AM
 
How serious is this ? i compiled without turning pear off
and it had the errors, yes. Put it looks like PHP runs OK
on first site (phpinfo() works).

Exactly what does PEAR do or contain?
--- tr909 webdesign ---
     
gdif
Fresh-Faced Recruit
Join Date: Mar 2001
Status: Offline
Reply With Quote
Mar 26, 2001, 10:59 AM
 
Pear is an effort to build a massive shared library of routines, must like Perl's DBI. I don't know that is normall installed AFTER pear in the make install, but I thought it was worth doing it with pear disabled to make sure all the required parts of PHP were copied. It's always hard to tell what someone else's PHP program will require when you go to install it.

I did, btw, file a bug report on this at php.net. It had supposedly been fixed a couple of times but keeps getting unfixed.

--gdif
     
justinkim
Mac Enthusiast
Join Date: Sep 2000
Location: New York, NY USA
Status: Offline
Reply With Quote
Mar 27, 2001, 12:36 AM
 
I got the following errors after typing "make:"

make[3]: *** [php_msql.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

I went ahead and did "make install" anyway. This is what is gave:
make[3]: *** [php_msql.lo] Error 1
make[2]: *** [install-recursive] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install-recursive] Error 1

Can anyone help?
     
torifile
Mac Elite
Join Date: Jan 2001
Status: Offline
Reply With Quote
Mar 27, 2001, 12:44 AM
 
I got those errors too. I just ignored them and finished up the directions and they worked fine. Try it and see.
     
Alex Duffield
Grizzled Veteran
Join Date: Oct 2000
Location: Vancouver
Status: Offline
Reply With Quote
Mar 27, 2001, 12:55 AM
 
It looks like OS X 10.0 has PHP installed already, but it is not running.. Wouldn't it be easier to turn it on, instead of installing a new one?
Alex Duffield
http://www.incontrolsolutions.com
Fatal error: Call to undefined function: signature() in /usr/local/www/htdocs/showthread.php on line 813
     
00101001
Mac Enthusiast
Join Date: Jan 2001
Status: Offline
Reply With Quote
Mar 27, 2001, 01:06 AM
 
Originally posted by Alex Duffield:
It looks like OS X 10.0 has PHP installed already, but it is not running.. Wouldn't it be easier to turn it on, instead of installing a new one?
yeah, hasn't anybody had any success with using the included PHP stuff on osx?
     
Mixmaster
Fresh-Faced Recruit
Join Date: Mar 2001
Status: Offline
Reply With Quote
Mar 27, 2001, 10:15 PM
 
Originally posted by 00101001:
yeah, hasn't anybody had any success with using the included PHP stuff on osx?
No, the DSO that ships as part of X does not work. It's broken. You can build your own, as described above (other arguments are possible for the configure command, for setting up MySQL, for example. Or I was told today that someone has created a package to install an up-to-date binary DSO that works. I don't have the URL but I'll try and find it. The advantage of the package is that you just have to double-click it and it installs.
     
mr_jb
Fresh-Faced Recruit
Join Date: Mar 2001
Location: nyc, ny, usa
Status: Offline
Reply With Quote
Mar 28, 2001, 01:58 AM
 
Originally posted by tr909:
I got some emails asking how to install PHP here is what i anwsered:

go to the directory where you unstuffed (GZ and TAR) the
php-4.04l1 distribution files and type the following commands (each one will take a few minutes):

and then you have to edit apache config

/private/etc/httpd/httpd.conf

[This message has been edited by tr909 (edited 03-26-2001).]
Hi, I'm new to Apache/UNIX. I read in another thread that my Web Sharing can't start up because I installed over the Public Beta, which wipes the apache conf file. Where would I find this file in my system, and since I can't, where should it be and what the contents should be?

Any help greatly appreciated.

Jeff
[email protected]

     
tr909  (op)
Fresh-Faced Recruit
Join Date: Oct 1999
Location: NL
Status: Offline
Reply With Quote
Mar 31, 2001, 04:02 PM
 
Double clickable packages are already surfacing.

fecker posted the following in another website's forum's thread:

> posted 03-29-2001 07:14 AM
>
> I now have PHP and MySQL running
> installers both here:-
> http://homepage.mac.com/fecker/
> The php is a package from a previous post
> and MySQL is from tenon.com
--- tr909 webdesign ---
     
Mr. D
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Switzerland
Status: Offline
Reply With Quote
Mar 31, 2001, 05:29 PM
 
I managed to compile PHP4 using the 'disable pear' command, but I still can't get PHP code in HTML page to work ...

the PHPINFO.PHP works fine, a pure PHP page works too, but when I try to mix HTML and PHP I just don't get what I want (a simple 'echo' commande).

Any workaround ?
     
torifile
Mac Elite
Join Date: Jan 2001
Status: Offline
Reply With Quote
Apr 1, 2001, 12:33 PM
 
Originally posted by Mr. D:
I managed to compile PHP4 using the 'disable pear' command, but I still can't get PHP code in HTML page to work ...

the PHPINFO.PHP works fine, a pure PHP page works too, but when I try to mix HTML and PHP I just don't get what I want (a simple 'echo' commande).

Any workaround ?
I had this problem too. I spent hours scratching my head over it when I realized what my problem was: my page was called *.html when it should have been called *.php if I wanted php to read it! That was it. I swear I could have killed myself for not realizing it sooner. Maybe that's what's going on for you too.
     
Mr. D
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Switzerland
Status: Offline
Reply With Quote
Apr 1, 2001, 03:15 PM
 
gemme a gun ... that was it ... thousand thanx =)
     
Mr. D
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Switzerland
Status: Offline
Reply With Quote
Apr 1, 2001, 03:33 PM
 
well well well ... I talked too fast ... I'll let the gun down for later ...

it seems that the '<?php' doesn't "launch" php interpretation ... and any HTML code that follow that is simply ignored ...

need some more help ... it seems ..

[This message has been edited by Mr. D (edited 04-01-2001).]
     
Mr. D
Fresh-Faced Recruit
Join Date: Mar 2001
Location: Switzerland
Status: Offline
Reply With Quote
Apr 4, 2001, 05:51 AM
 
YES YES YES !! I got it !! =)

so :

1. call your php pages 'X.php'
2. to view the result, don't just load the file ! Access it by '127.0.0.1/X.php'. Otherwise there will be no PHP interpretation.

OK ... going back to 'php for dummies'
     
tr909  (op)
Fresh-Faced Recruit
Join Date: Oct 1999
Location: NL
Status: Offline
Reply With Quote
Apr 6, 2001, 09:31 AM
 
OK, i will try to shed some light on this...
the AddType application/x-httpd-php .php directive
in HTTPD.CONF tells apache to give files with these
extentions (.php / .phps) to the PHP module.
if you also want .HTML files to (be parsed by / given to)
the PHP module then you will have to add or modify the
AddType blahblah .html

Another one: a php file (.php) doesn't HAVE to contain
php. It can also be just a file with html code.
the php module looks for code between <? ?> and only
then tries to process that code. So essentially you
can jump into and out off php mode any time in the html.
an example: hello <b> <? echo $name; ?> </b>
please take a look at the php manual and tutorials on
php.net there is also a great (search-indexed) PDF manual there.

greetings,
Tr909
--- tr909 webdesign ---
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:32 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,