PHP stopped working on Apache after upgrade to OS x 10.10.1 Yosemite - Owncloud broken

1.8k views Asked by At

Context: I'm trying to run Apache on my local Mac27" (2009) so that I can use OwnCloud as an alternative to Apple's iCloud (I just want to do local sync of my calendar like in the good-old "OS X big cat" days. For paranoid privacy reasons I don't want Cupertino to know who I know or what I'm doing - probably misplaced, but there you go). My foray into this were based on a blog post by Michael Gracie at http://michaelgracie.com/2013/11/13/getting-ios-7-calendar-and-contacts-syncing-directly-with-os-x-10-9-mavericks/ (for which many thanks are due).

When I upgraded to Yosemite a few weeks ago (remind me why I did this?) I spent an age mending my very simple setup and I was back . Yesterday I upgraded (again, remind me why I did this?) to 10.10.1 and it broke again. Everything seems like it should work, but PHP is not running.

The symptom is that, when I run OwnCloud (localhost/owncloud/index.htm), I get the OwnCloud logo and styling and then an error:

PHP module GD is not installed.
Please ask your server administrator to install the module.

This, however, is a diversion, because it's not the GD module which is the problem - I think that Apache can't see PHP at all. The reason is as follows:

1) Does PHP run on Apache?

When I go to:

http://localhost

I see the Apache "It Works!" message.

Adapting the index.html.en file in /Library/Webserver/documents/ allows me to modify that message, however, when I call PHP from within that file e.g.

    <h1>It works!</h1>
    <h2>This file is in /Library/Webserver/Documents</h2>
    <h3>Trying to printout phpinfo()</h3>
    <?php
            echo phpinfo();
    ?>

Then I see three lines of text but no PHP info.

So PHP is not available when rendering that webpage.

2) Is PHP available at all?

Investigating this, I run the following command from the terminal:

sudo echo <?php phpinfo() ?> | php

and I get four-thousand lines of PHP info, which includes

'--with-gd'

in the configure command.

3) Has Apache loaded the PHP module?

I then run:

httpd -t -D DUMP_MODULES

Apache tells me that, among many other modules it is using:

php5_module (shared)

4) Is the httpd.conf file compatible with this:

I've been through httpd.conf in my /etc/apache2 directory and have uncommented the following lines:

LoadModule php5_module        libexec/apache2/libphp5.so
LoadModule authn_core_module libexec/apache2/mod_authn_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so

5) What else?

Just to complete the picture, in my /etc/apache2/users file I have configured my own user settings to:

<Directory "/Users/DJBrown/Sites/">
    Options Indexes MultiViews FollowSymLinks
    Require all granted
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

(I confess, at this point - as well as others - I'm really not quite sure what I'm doing since I've following much of this from some other answers in StackOverflow).

6) Conclusion

Apache is running with PHP is loaded and both httpd and PHP can be interrogated from the command line ... but Apache won't run PHP.

Is that possible?

What have I missed?

Any help gratefully received.

DJ

1

There are 1 answers

1
doctordjbrown On

Here's a partial answer.

Changing the line in httpd.conf

AddType application/x-httpd-php .php

to

AddType application/x-httpd-php .php .htm .html

Permits apache to render in-line PHP code in HTML files.

(I got this from http://php.about.com/od/advancedphp/p/html_php.htm)

I still have an OwnCloud problem now, which I will take to their forum

Thanks for your help birdspider

DJ