Steps to do:
- Follow coolestguyplanettech.org (thanks for all the information) to get apache running with php, phpmyadmin and mySQL with user directories appropriate to your needs
- Install imagemagick using Macports.
- Since the apache server runs as user _www in group _www you need to change the path variable for it so that apache can find convert (it doesn't use your path variable)
For this you need to change the launchd file (thanks to this stackoverflow entry):
sudo nano /System/Library/LaunchDaemons/org.apache.httpd.plist
After having put in your password, this will open a text editor with the file specified in the path. With the arrow keys navigate to the end of the file.Mark the following section in this blog entry and copy it
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin</string>
</dict>
In the terminal navigate to the line before </dict>, create a new line and paste the upper section via an "alt+click" or right click and "paste". The file should look like this now:<dict>
<key>PATH</key>
<string>/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin</string>
</dict>
[...]
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin</string>
</dict>
</dict>
</plist>
Save the file by casting the key codes command+o, return (this writes the file), and command+x (this closes nano).
Now you need to restart apache. Do not only give a restart, but stop and start the apache with the commands
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin</string>
</dict>
</dict>
</plist>
sudo apachectl stop
sudo apachectl start
Since the path variable is updated you should now be able to use a fully functional "convert" in your php/perl scripts. sudo apachectl start
Happy converting pictures with your apache test server.
Update
I noticed a ridiculously large log file being saved by Time Machine regularly after working with the MacOS apache. Solution: navigate to the apache configuration file /private/etc/apache2/httpd.conf and set the warn level to "emerg" using e.g. nano.
No comments:
Post a Comment