tonex
tonex

Reputation: 87

How to enable php.ini in Mountain Lion and make it work?

I'm using Mountain Lion.

I'm having problems making sessions work in PHP. By default, there is no /etc/php.ini so I copied /etc/php.ini.default.

sudo cp /etc/php.ini.default /etc/php.ini

Now, I'm not doing anything with php.ini yet. I restart apache just to test.

sudo apachectl restart

Browsing my local site, it shows the PHP code, and not the interpreted HTML. If I delete /etc/php.ini (and after restarting apache again), the site gets rendered correctly again.

phpinfo() shows php.ini is located at /etc folder.

My webroot is /Library/WebServer/Documents. I don't want to use the setup the webroot that lets me use

http://localhost/~username.

I appreciate your help. Thanks.

Upvotes: 1

Views: 1951

Answers (1)

tonex
tonex

Reputation: 87

I figured it out. short_open_tag is set to off and I was using short_open_tags. I just learned that short_open_tags are not advisable now.

http://machiine.com/2013/how-to-enable-and-setup-php-ini-on-a-mac-with-osx-10-8-mamp-part-4/ helped me.

Upvotes: 2

Related Questions