PDA

View Full Version : How do you test your php based stuff ?


dmegatool
2009-03-23, 13:21
Hey there !
My coworker use andLinux to test their php sites. I don't need to do it often but I need it to view some php pages right now. I don't want to run andLinux in my Parallels VM... it's super slow and don't feel like a real solution.

What do you guy suggest me ? I'm the only Mac in here so I would need some help :) I didn't talk to the IT guy but I'm pretty sure he's not so Mac (he's new).

noleli2
2009-03-23, 14:58
PHP comes installed with Leopard; you just have to enable it.

Just edit Macintosh HD/private/etc/apache2/httpd.conf. Scroll down to right around line 114 and uncomment the line about loading PHP.

Restart (or start) Web Sharing from the system prefs, and you now have a working, local installation of PHP.

Save your PHP files in ~/Sites, and view them by going to http://localhost/~user/myFile.php

More complete explanation: http://foundationphp.com/tutorials/php_leopard.php

Ryan
2009-03-23, 16:22
However, the stock Mac install of PHP could very well be different from your production server. You might want to make sure both have similar configurations. Same applies for any frameworks you might use.

dmegatool
2009-03-23, 19:11
Wow, it's sounds so easy... sounds so Mac :P

I'll give it a try tomorrow. Thanks guys

drewprops
2009-03-23, 23:28
Ooof. I need to try that. Changing the environmentals is probably wicked haaaad though... yeah?

Brad
2009-03-24, 03:44
Bah! Here I thought you guys were going to be talking about something like PHPUnit (http://www.phpunit.de/) or SimpleTest (http://www.simpletest.org/). :p

To the task, I would never recommend testing a PHP site on a Mac unless it just consists of tiny pages using the most basic of PHP functions.

If this is anything serious like a website for a business client, you should at least be testing with the same version of PHP with all the same modules (something that's already going to be difficult on your Mac), and preferably do it on the same platform (OS, http server, database, etc). Running in a VM would by far be the best solution since it would give you an environment as close to the real thing as possible. Plus, it would save you countless hours spent pulling hair and gnashing teeth trying to find/compile/configure all the right binaries for the Mac. ;)

But for just dinking around for fun or practice? Sure, a Mac will suffice.

Ooof. I need to try that. Changing the environmentals is probably wicked haaaad though... yeah?

Yeah. Getting the matching version of PHP would mean crippling your current version and finding, installing, and configuring the right version, but it's really probably not worth the effort since Apache will probably be a different version, as well as everything else on the Mac completely mismatching the production environment.

dmegatool
2009-03-24, 07:42
Yeah I'm aware of all the implications but most of the time it's pretty simple things*. And if things doesn't work, it's not that bad, I'll start my VM again :\

*Like now, we had to do a flash with a "blending mode multiply" on a transparent background.... works on every PC browser including Safari but it doesn't work on any MAc browser. For the rest, it's mostly to se if things align correctly...

dmegatool
2009-03-24, 08:16
Argh... forgot that the site had a DB. I have a .sql in a folder wich I guess would be a DB dump ? I just don't know what to do with that... It begins to feel out of my competence range :)

Can't connect to local MySQL server through socket '/private/tmp/mysql.sock' (2) in /Users/~User/Sites/sources/www/classes/database/DB.class.php on line 55

That's the kind of errors I'm getting trying to view the site :\

noleli2
2009-03-24, 09:34
I would see if you can connect to the remote database just as you would on the server. (i.e. change localhost to the actual remote host where the database lives.)

dmegatool
2009-03-24, 09:56
I got an Linux guy that said he would try to help me (Yay). I guess it'll be easier for him... I'll tell you how it went (probably not today).

dmegatool
2009-04-09, 20:03
Just wanted to let you know that I've found a little software that does exactly what I needed. MAMP (http://www.mamp.info/en/index.html)

It's just a few click and it's ready. It's super easy to add new host (even edit the host file automatically). So it's basicly an Apache web server, MySQL database server, you access your db with phpMyAdmin... perfect