Xamp/wamp alt. for mac? |
Xamp/wamp alt. for mac? |
![]()
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
I have a mac now and im looking for something that will allow me to test website that use php includes without outting them ive on my server. Whats a free program that can do this? Is there something at http://www.apple.com/downloads/? And I dont get that site. How can I just view all the free downloads? hehe. thanks.
Edit: I just saw that php and apache are actually pre installed on the mac. Who knows how to enable it? I was hoping there was a way to do it, not in the terminal but it looks like their isnt. |
|
|
![]() |
![]()
Post
#2
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 ![]() |
They're command-line programs -- you call them from the Terminal.
Here's a quick bash script to do what you want: CODE #!/bin/bash for f in ~/Sites/**/*.php; do sed 's_/includes_../includes_' < $f > "${f}.new" mv "${f}.new" $f done Or Ruby, if you prefer: CODE #!/usr/bin/env ruby
def fix(file) tmp = File.open "#{file}.tmp", 'w' File.open(file).each do |line| s = line.gsub %r{/includes}, '../includes' tmp.puts s end tmp.close File.rename tmp.path, file end def getfiles(path) Dir.foreach(path) do |f| if File.directory? f getfiles f unless f =~ /^\.\.?/ else fix "#{path}/#{f}" if f =~ /\.php$/ end end end if __FILE__ == $PROGRAM_NAME getfiles File.expand_path '~/Sites' end |
|
|
![]() ![]() |