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 ![]() |
|
|
|
![]()
Post
#3
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
I take it macports is more for programming? I couldnt really figure out what it even was by reading the site.
But dang! That was easy. And I love how there is a sites folder. If I had known about this on macs I would have bought one ages ago! |
|
|
![]()
Post
#4
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 ![]() |
I take it macports is more for programming? I couldnt really figure out what it even was by reading the site. It's a package manager (similar to BSD Ports or Gentoo Portage, and similar in spirit to apt-get on Debian Linux). But dang! That was easy. And I love how there is a sites folder. If I had known about this on macs I would have bought one ages ago! Yes. It is. |
|
|
![]()
Post
#5
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
So, where exactly do I put the sites contents? I put a whole site that uses php into the sites folder but then when I go http://555.555.5.55/~joseph/ or http://555.555.5.55/ it doesnt actually change anything.
That isnt the actual number but I wasnt sure if it was something I needed to keep private. haha. |
|
|
![]()
Post
#6
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 ![]() |
|
|
|
![]()
Post
#7
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
Php files arent working. All its doing is showing the text in the file. Why is it doing this? Don't macs come preinstalled with php? there is an index.php in the sites folder but it is just showing the directory files.
|
|
|
![]()
Post
#8
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 ![]() |
Oh, sorry. Forgot that PHP isn't enabled by default in Leopard. First, disable web sharing. Then you need to edit the file /etc/apache2/httpd.conf. Open that file, find the line #LoadModule php5_module libexec/apache2/libphp5.so, and uncomment it (remove the # mark). Then restart web sharing (to restart Apache). Should work after that.
|
|
|
![]()
Post
#9
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
ok. I was hoping there was a way to do it that didnt involve getting into those files but watevs. haha.
How exactly do I get there? I looked for a etc folder in the macintosh hd and I looked in library and system. ? |
|
|
![]()
Post
#10
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 ![]() |
How exactly do I get there? I looked for a etc folder in the macintosh hd and I looked in library and system. ? It's hidden. You can get to it in 2 ways:
|
|
|
![]()
Post
#11
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
I took away the # and hit command+s and it asked for the password so I entered it but when I went back to web sharing to turn web sharing back on, it was un clickable. Only bluetooth is clickable now.
nvm, I ha to unlock the settings. Its working! Thanks :) Please dont close this yet though. |
|
|
![]()
Post
#12
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
Do you know how I could make a "sub domain" for localhost? Often my sites need to be tested in the base directory and I dont want to have to remove one site to test out another one. Something like http://test.localhost/~joseph/
|
|
|
![]()
Post
#13
|
|
![]() /人◕‿‿◕人\ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Member Posts: 8,283 Joined: Dec 2007 Member No: 602,927 ![]() |
why not just http://localhost/~joseph/test ?
|
|
|
![]()
Post
#14
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 ![]() |
Do you know how I could make a "sub domain" for localhost? Often my sites need to be tested in the base directory and I dont want to have to remove one site to test out another one. Something like http://test.localhost/~joseph/ Read this. Although I'm inclined to say just use http://localhost/~joseph/test, etc. |
|
|
![]()
Post
#15
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
why not just http://localhost/~joseph/test ? Because then the pointing of everything works differently. |
|
|
![]()
Post
#16
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 ![]() |
|
|
|
![]()
Post
#17
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
I mean when im working on a large site I dont want to have to go through every page and change <?php include("/includes/header.php") ?> to <?php include("../includes/header.php") ?> or whatever the case is. Unless I can find a script that goes through all the pages and replaces one thing with another.
|
|
|
![]()
Post
#18
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 ![]() |
I mean when im working on a large site I dont want to have to go through every page and change <?php include("/includes/header.php") ?> to <?php include("../includes/header.php") ?> or whatever the case is. Right, I know... But if you're serving under localhost/~joseph, /includes/... isn't going to work anyway, it'd have to change to /~joseph/includes. Unless I can find a script that goes through all the pages and replaces one thing with another. You can. It's called "awk" or "sed", and it comes with your Mac. |
|
|
![]()
Post
#19
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
Right, I know... But if you're serving under localhost/~joseph, /includes/... isn't going to work anyway, it'd have to change to /~joseph/includes. You can. It's called "awk" or "sed", and it comes with your Mac. Are you for freaking serious? They have all these hidden features! |
|
|
![]()
Post
#20
|
|
![]() /人◕‿‿◕人\ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Member Posts: 8,283 Joined: Dec 2007 Member No: 602,927 ![]() |
They're not hidden.
|
|
|
![]()
Post
#21
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 ![]() |
|
|
|
![]()
Post
#22
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 ![]() |
Well I didnt know about them. haha. How do I use them? I cant find them in spotlight.
|
|
|
![]()
Post
#23
|
|
![]() 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 |
|
|
![]() ![]() |