Jump to content

Recommended Posts

Hi there,

 

I've been struggling to get PHP to work on OS X 10.6 for a few days now, and it's beginning to grate!

 

I initially had the web server turned on fine and then went to install the latest PHP release via Marc Liyanage installation package. Weirdly that corrupted the web server (going to 'localhost' didn't work, and nor did 'localhost/~username/' -- both just timed out). After much faffing I removed the pkg install, and seemingly restored everything back to what it was.

 

I then went for the more straightforward option of just uncommenting the line in httpd.conf which disables PHP by default. I also copied the php.ini.default file to php.ini. Now a bit of progress, I could run a simple test.php consisting of just phpinfo(). However, when I tried to connect to my MySQL database (again, on localhost and apparently running fine -- MySQL workbench is happy as) and had a 'die' statement in the line it threw a 'No such file or directory error'. More strangely, if I deliberately introduced a syntax error (e.g. removed a semi-colon) it didn't produce any errors, just displayed a blank screen. I downloaded php.ini-development and replaced php.ini with it; still no error reporting. To compound matters, after a few refreshes with deliberately broken code, PHP pages stop-loading and Chrome just throws a timeout error (actually 'Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.'). Even when I revert the test.php contents back to an innocuous 'hello world' it still fails to load. I can guarantee that if I come back tomorrow morning though, it will run a 'hello world' program, but still misbehave with MySQL and error reporting.

 

I've attached my httpd.conf file (from /etc/apache2) and my php.ini (which should be identical to php.ini-development as I just downloaded it from cvs.php.net). In httpd.conf there is only one line that contains the string 'php', namely line 115 -- should there be any more php-related directives in there?

 

I would be so grateful for any suggestions. I've never had this much difficulty getting PHP up and running in the past!

 

Thank you so much,

 

Mat

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/208352-odd-behaviour-on-apache/
Share on other sites

Sorry, solved my own problem.

 

- Copied httpd.conf from /etc/apache2/original to /etc/apache2

- Looked at http://php.net/manual/en/install.macosx.bundled.php

- Inserted the lines:

LoadModule php5_module libexec/httpd/libphp5.so

AddModule mod_php5.c

 

<IfModule mod_php5.c>

    # If php is turned on, we respect .php and .phps files.

    AddType application/x-httpd-php .php

    AddType application/x-httpd-php-source .phps

 

    # Since most users will want index.php to work we

    # also automatically enable index.php

    <IfModule mod_dir.c>

        DirectoryIndex index.html index.php

    </IfModule>

</IfModule>

 

- Didn't work. Discovered that libphp5.so was actually located in libexec/apache2/, so updated that reference

- Checked the Console, it said that there's no such command as 'AddModule'. Removed this line and changed the 'IfModule' line to 'IfModule php5_module'. I was improvising BIG TIME on that last bit, it appears to have done what it sets out to do (i.e. it loads index.php by default)

 

I'm cautiously optimistic!

 

Mat

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.