Log In · Register

 
Xamp/wamp alt. for mac?
Maccabee
post Aug 14 2009, 01:53 AM
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.
 
 
Start new topic
Replies
mipadi
post Aug 15 2009, 11:58 AM
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
 

Posts in this topic
jcp   Xamp/wamp alt. for mac?   Aug 14 2009, 01:53 AM
mipadi   Macs already have Apache and PHP. Just go to Syste...   Aug 14 2009, 07:21 AM
jcp   I take it macports is more for programming? I coul...   Aug 14 2009, 11:06 AM
mipadi   QUOTE(jcp @ Aug 14 2009, 12:06 PM) I take...   Aug 14 2009, 11:16 AM
jcp   So, where exactly do I put the sites contents? I p...   Aug 14 2009, 11:26 AM
mipadi   QUOTE(jcp @ Aug 14 2009, 12:26 PM) That i...   Aug 14 2009, 12:04 PM
jcp   Php files arent working. All its doing is showing ...   Aug 14 2009, 12:09 PM
mipadi   Oh, sorry. Forgot that PHP isn't enabled by de...   Aug 14 2009, 12:14 PM
jcp   ok. I was hoping there was a way to do it that did...   Aug 14 2009, 12:20 PM
mipadi   QUOTE(jcp @ Aug 14 2009, 01:20 PM) How ex...   Aug 14 2009, 12:24 PM
jcp   I took away the # and hit command+s and it asked f...   Aug 14 2009, 12:41 PM
jcp   Do you know how I could make a "sub domain...   Aug 14 2009, 04:28 PM
mipadi   QUOTE(jcp @ Aug 14 2009, 05:28 PM) Do you...   Aug 15 2009, 11:01 AM
Buttsex   why not just http://localhost/~joseph/test ?   Aug 14 2009, 06:04 PM
jcp   QUOTE(Buttsex @ Aug 14 2009, 06:04 PM) wh...   Aug 15 2009, 11:06 AM
mipadi   QUOTE(jcp @ Aug 15 2009, 12:06 PM) Becaus...   Aug 15 2009, 11:13 AM
jcp   I mean when im working on a large site I dont want...   Aug 15 2009, 11:17 AM
mipadi   QUOTE(jcp @ Aug 15 2009, 12:17 PM) I mean...   Aug 15 2009, 11:22 AM
jcp   QUOTE(mipadi @ Aug 15 2009, 11:22 AM) Rig...   Aug 15 2009, 11:26 AM
mipadi   QUOTE(jcp @ Aug 15 2009, 12:26 PM) Are yo...   Aug 15 2009, 11:48 AM
Buttsex   They're not hidden.   Aug 15 2009, 11:30 AM
jcp   Well I didnt know about them. haha. How do I use t...   Aug 15 2009, 11:50 AM
mipadi   They're command-line programs -- you call them...   Aug 15 2009, 11:58 AM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: