I've recently purchased an Apple iMac. Unfortunately, enabling Apache and PHP has thrown up some problems.
I enabled Mac's built-in Web Sharing through System Preferences, at which point I got an output and could add HTML files to my user directory. However, PHP files were being displayed rather than interpreted. I then discovered this is because PHP isn't enabled by default on Mac's Apache set-up.
After a quick Google search, I came across this page: http://developer.apple.com/mac/articles/internet/phpeasyway.html
I proceeded to the section, Enabling PHP in Apache, copying and pasting the following code snippet into a new Terminal window and hitting Return:
set admin_email to (do shell script "defaults read AddressBookMe ExistingEmailAddress")
user_www=$HOME/Sites
filename=php-test
user_index=${user_www}/${filename}.php
user_db=${user_www}/${filename}-db.sqlite3
# NOTE: Having a writeable database in your home directory can be a security risk!
conf=`apachectl -V | awk -F= '/SERVER_CONFIG/ {print \$2}'| sed 's/"//g'`
conf_old=$conf.$$
conf_new=/tmp/php_conf.new
touch $user_db
chmod a+r $user_index
chmod a+w $user_db
chmod a+w $user_www
echo "Enabling PHP in $conf ..."
sed '/#LoadModule php5_module/s/#LoadModule/LoadModule/' $conf | sed
"s^
[email protected]^<b>\$admin_email</b>^" > $conf_new
echo "(Re)Starting Apache ..."
osascript <<EOF
do shell script "/bin/mv -f $conf $conf_old; /bin/mv $conf_new $conf;
/usr/sbin/apachectl restart" with administrator privileges
EOF
Unfortunately, this has completed thrown Apache and now nothing is being served; instead I'm receiving "Failed to open page" errors because it cannot connect to the server, despite Web Sharing still being active in System Preferences.
So therefore I guess my question is this: how can I undo the changes made by the copy-and-pasting of the above code snippet? Admittedly, I don't understand what the above did; I just thought it looked like a Terminal command and tried it. I have no experience in setting up Apache on Mac
OS X (and I've only installed XAMPP and WampServer on Windows).
So any points on reversing the aforementioned, and then successfully enabling PHP would be great.
EDIT: I've discovered, via Console, the following error message is being recorded when trying to browse to 127.0.0.1...
(org.apache.httpd) Throttling respawn: Will start in 10 seconds
no listening sockets available, shutting down
Unable to open logs
(org.apache.httpd[13453]) Exited with exit code: 1
Does this point any more to the issue?
EDIT #2: I'm now getting this in Console...
15/02/2010 21:24:14 osascript[3597] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper