Click to See Complete Forum and Search --> : MAC OS X PHP5 and apache


solidariti
08-29-2007, 10:36 AM
After reinstalling my MAC OS X operating system I can't seem to get php working with apache, it just displays the php code, not parsing it.

I have installed PHP5 and followed entropys instructions, which I did before the reinstall. But it doesn't work. I haven't changed the apache installation on the machine. I have uncommented:

LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c

Restarted the server, but it still doesn't work, any ideas? Is this right or should it be php5? Considering I installed php5.

Thank you

flann
08-29-2007, 12:49 PM
try commenting those lines (restart apache) and find what your server's document root is. Put a test page like the following in your document root:

<?php
phpinfo();
?>


do you get the php info?

solidariti
08-29-2007, 01:02 PM
Wahoo it works now thank you thank you, I have one issue though I'm trying to get the virtual hosts working I've been on it all day, arrghh, lol.

This is what I have so far:

httpd.conf:

#
NameVirtualHost *:80
DocumentRoot /Users/username/Sites/2Sites/
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot
ServerName localhost
</VirtualHost>


users/*.conf

<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>



<VirtualHost test.site.com:80>
ServerName test.site.com
DocumentRoot /Users/username/Sites/2Sites/site.com
<Directory "/Users/username/Sites/2Sites/site.com">
Options Indexes FollowSymLinks +Includes +ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
127.0.0.1 test.example.com
::1 localhost




When I go to test.site.com it just sends me to my internet provider error page which is talk talk; http://localhost works fine though

Any ideas, I have searched the internet and changed it so many times, but it still doesn't work and each time I have restarted apache using apachectl restart.

Thank you for taking the time to help me out

flann
08-29-2007, 01:04 PM
If site.com isn't pointed at your server, your browser is going to automatically goto site.com on the internet. I would recommend just using localhost for now.

solidariti
08-29-2007, 01:41 PM
Sorry I changed the names of them for privacy sake; they are the same in the host file and the users file.


Can you see anything wrong with them, after I did apachectl configtest

Processing config directory: /private/etc/httpd/users/*.conf
Processing config file: /private/etc/httpd/users/+entropy-php.conf
Processing config file: /private/etc/httpd/users/username.conf
[Wed Aug 29 19:11:19 2007] [warn] NameVirtualHost *:80 has no VirtualHosts
Syntax OK

in the httpd.conf file I have:

NameVirtualHost *:80
DocumentRoot /Users/jamesapps/Sites
ServerName localhost


username.conf:


<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>



<VirtualHost test.username.com:80>
ServerName test.username.com
DocumentRoot /Users/username/Sites/2Sites/example.com
<Directory "/Users/username/Sites/2Sites/example.com">
Options Indexes FollowSymLinks +Includes +ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>





host file:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
127.0.0.1 test.example.com
::1 localhost


Please if you could help resolve this issue I would be very appreciative, I would like to have test.example.com as a virtual host is the above right?

flann
08-29-2007, 02:16 PM
what does your domain's ip resolve to? Use the link below, but change the yourdomain.com to your domain.

http://www.dnsstuff.com/tools/dnsreport.ch?domain=yourdomain.com

What is the ip address of your server? If your domain resolves to a different ip than your server, than it won't find it.

solidariti
08-29-2007, 03:56 PM
Cant I just do name based virtual hosting, it is just for local development.

solidariti
08-29-2007, 04:27 PM
Thank you for your help I have fixed it