matstuff Posted July 20, 2010 Share Posted July 20, 2010 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] Quote Link to comment https://forums.phpfreaks.com/topic/208352-odd-behaviour-on-apache/ Share on other sites More sharing options...
matstuff Posted July 20, 2010 Author Share Posted July 20, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/208352-odd-behaviour-on-apache/#findComment-1088865 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.