Um das "hello world" Programm in PHP zu schreiben:
(klicke hier, falls Du Deinen Mac zuerst für PHP konfigurieren musst)
first - and you have to do this only ONCE!
- open a file called httpd.conf
- you will find this file in macintoshHD/private/etc/apache2
- !!! watch out! this is an important file, don't mess with it !!!
- in my OS around line 115 is the instruction to load the php Module
- this instruction is commented out:
- (and in your OS it may not be php5, but php4 or php-something-else)
-
# LoadModule php5_module libexec/apache2/libphp5.so
- uncomment this instruction: (remove the #)
- LoadModule php5_module libexec/apache2/libphp5.so
- you may be asked for your password to be able to save this change
- restart apache in terminal:
- sudo apachectl restart
- again you may be asked for your password
- once you are done, you can click this purple area to make it go away
- if you need it again, click the purple PHP above
- Im Ordner "Sites": Ordner "firstProgrammes" anlegen - falls noch nicht getan
- In firstProgrammes, lege eine Datei salem.php an und speichere sie.
Schreibe folgenden Code in die Datei (oder von hier direkt herunterladen/kopieren):
<html>
<body>
<?php
echo "Hello World";
?>
</body>
</html>
- speichern
- in safari: http://localhost/~USERNAME/firstProgrammes/salem.php
zurück