Reputation: 54013
I've got php installed on my mac, but it doesn't seem to want to work with me. When I execute the following on the command line it seems to work:
kramer65s-laptop:bunq-support kramer65$ php -r 'echo "something\n";'
something
but when I visit a file in my Sites directory (http://localhost/~kramer65/somefolder/echosomething.php
), it simply shows this as text in the browser: <?php echo "something\n"; ?>
.
So my question is how can I get php to evaluate my php pages?
Upvotes: 0
Views: 118
Reputation: 286
Try Install MAMP software on your system its a free software available on net using this you can easily run the application on the server it comes with Apache,Mysql and PHP so no need to install all these seperately.
Upvotes: 0
Reputation: 3566
You have to enable PHP.
In terminal:
sudo nano /etc/apache2/httpd.conf
Locate following line and remove '#'
from the beginning:
LoadModule php5_module libexec/apache2/libphp5.so
Now, to restart apache
and reload configuration:
sudo apachectl -k restart
There is also another way of doing this, when you need to install PHP 5.4 and have OS X in version lower than 10.9.
You can use homebrew
to install PHP 5.4 and even 5.5. Installator will also configure your environment to use new PHP.
Some people find it useful, but I like to do things my way, especially because there's no big need to install 5.4 right now. Symfony2
works on 5.3, as well as zf2
.
Anyway you have two options to go. First is easier, second gives you more flexibility. Hope that helps.
Upvotes: 2