Php vs Apache

HSN

Registered
Hi guys,

I'm new to MAC and new to your community. It's a nice place though.

I'm a php developer. I know that there is already a version of apache and php installed on my iMAC machine. However, I don't know how to configure them or make them run!! I read some articles in mac.com's support but I couldn't find enough info about that.
 
HSN,
There's a ton of information on the web about this.

But, here's a simple three-step list of instructions to get PHP/Apache running on your mac.

Step 1:
Open System Preferences, click on "Sharing" and enable "personal web sharing". Boom! Apache and PHP should be running, wasn't that easy? Okay stay with me now...

Step 2:
Check to make sure everything is working by opening your a browser (aka Safari) and typing in the following address:
http://localhost/

You should see the Apache welcome screen. The root directory of Apache is on your computer here:
/Library/WebServer/Documents/

Your user root folder is here:
/Users/<your username here>/Sites/

You can access your user site folder here:
http://localhost/~<your username here>

You can also use your computer's shared name in place of the "localhost" part of the aforementioned paths. (<something>.local).

Hope this helps... if not, check out the "Free Tech Support" link at the top of this page...
 
thx a lot.

However, I still have some problems. I made apache and php work. Then I installed mySQL and tried to use mysql_connect() to start working with php and mySQL. But I figured out that php is looking for mySQL's socket in a different directory than it is:
Code:
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) in

I tried to change this directory in the php.ini.default file. however, I couldn't find any related variable or something. Please let me know, how can I manage that?
 
mysql.default_socket = (line 658 in my /etc/php.ini file). If you make changes to this file you'll need to restart apache for the changes to take effect.

I'd suggest a double-check that MySQL is actually running and that you can connect with the "mysql" or "mysqladmin" commands, just in case PHP is configured correctly but MySQL isn't running. Just a thought.
 
Thanks for the help.

I made the change and I just restarted the personal web sharing from system preferences. However, I got the same error.
By the way, I have tested mySQL and it is running. I created my tables and everything.
I donno why my php.ini file has another ext called .default!!
 
I donno why my php.ini file has another ext called .default!!

It's just that, the default settings which PHP employs if it doesn't have a config. file (it ignores the .defaults file). You need to make a copy of that file, call it php.ini, put your changes in there, *then* restart apache (via the sharing preference pane is fine).
 
It's just that, the default settings which PHP employs if it doesn't have a config. file (it ignores the .defaults file). You need to make a copy of that file, call it php.ini, put your changes in there, *then* restart apache (via the sharing preference pane is fine).
Well, that was great. When I copied the php.ini file, it worked fine.

Thanks for your help.. :)
 
Back
Top