PHP and MySQL

Joined
May 29, 2009
Messages
18
Reaction score
0
Points
1
Hi,

I have read somewhere that PHP, MySQL and Apache come pre-installed with OSX. I can also see the sites folder in my home directory. If they are installed then how do I access them through my browser. In xampp you would just type http://localhost/ but it must be different with this package.

Also where are the httpd.conf and the virtual host files located?

Thanks
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
System Preferences > Sharing > Web Sharing is where you go to start Apache. You can also use apachectl if you wish.

As for httpd.conf, try /private/etc/apache2/.
 
Joined
Apr 29, 2006
Messages
4,576
Reaction score
378
Points
83
Location
St. Somewhere
Your Mac's Specs
Mac Studio, M1 Max, 32 GB RAM, 2 TB SSD
PHP is also there. It is a little tougher to get going, but not much. Google "enable PHP 10.5" and you will get lots of recipes for enabling PHP in Leopard. Change the query to "enable PHP 10.4" if you are running Tiger. Basically, you have to edit a config file or two, and then restart Apache, and that is it. Pretty simple.

Here is one such article: macosxhints.com - 10.5: How to enable PHP and MySQL in 10.5

I have Apache/PHP running on both my 10.4 based PowerMac G5 and my 10.5 based Mac Pro. I use both for website development and it works well on both machines (although Tiger comes with an older version of PHP).
 
OP
C
Joined
May 29, 2009
Messages
18
Reaction score
0
Points
1
I am having a bit of a problem with mysql. When I type mysql into the terminal it returns command not found. Any one got any ideas?

Thanks
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Yes I do ;). Here you go.

The article is 4 years old so post back if the instructions don't work.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top