Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vicki1

macrumors newbie
Original poster
Oct 1, 2008
9
0
I have downloaded MAMP to my computer and seems to be working, at least when I click on "open start page" the Mamp welcome page comes up telling me everything is installed and working.

I made a php file in Dreamweaver and saved it in the Mamp htdocs folder.

When I ask Safari or Firefox to open the page I keep getting "Not Found. The requested URL /MAMP/htdocs/test.php was not found on this server."

The full link I used was - http://localhost:8888/MAMP/htdocs/test.php
and also -
http://localhost:8888/Applications/MAMP/htdocs/test.php

Anyone have any ideas what I'm doing wrong? I've been trying for 2 days!!!

Thanks,
Vicki

MacPro G5 with Leopard 10.5.5
 
That worked. Thanks for that .... but ....

I tried to access a file within a folder in htdocs and it couldn't find it.

I purchased a book called php solutions and downloaded the files associated with it. I put the folder "php solutions" with all the chapters etc inside the folder in htdocs, but couldn't locate the files.

Do I need to remove them all and add them directly to the htdocs file?

Actually, just tried it, pulled one file out of its chapter folder and placed it direct into the htdocs folder, but the browser still couldn't find it!!!!!

What am I doing wrong????????

Vicki
 
Can you give examples of what you're trying? You're not giving us much to go on as is.
 
I pretty much did the same as the above, and could see all of my websites that i initially put in htdocs, in this link http://localhost:8888/
Now, my main problem is that i can not access any php files... i can easily see the html files (for instance an index.html works). When i try to access a website through the browser by clicking the link, i get "Direct Access to this location is not allowed." - i dont get it. Everything is installed, i am running MAMP on the default ports, and i should be able to view these php files, but direct access is not allowed????????????????????
Any suggestions? I would really appreciate it!
thank you!
 
Sorry. I assume you mean how I type the address in the browser?

http://localhost:8888/phptest.php - that was for the file I took out of chapter 2 files and placed in the htdocs folder. The file couldn't be found.

http://localhost:8888/phpsolutions/downloads/ch03/book.php - that was a file that was still in the php solutions folder which is in the htdocs folder. This file couldn't be found!!!

If I just typed http://localhost:8888/book.php it couldn't find the file either.

Hope I made more sense :)

Vicki
 
OK, I thought perhaps there might have been a weird character or a space in a folder, which can some times cause issues. I see you're trying PHP files. Do you have the same issue with HTML files like dvwood7 mentions he is? It's always hard to debug these things remotely. Try accessing the files without using the port number (the 8888, so try http://localhost/phptest.php). Also, as a check, in the System Preferences under Sharing, do you have Web Sharing checked? If so, uncheck it. Apple's web server is located in a different spot along with PHP and could cause conflict issues.

If this doesn't help, did you make any changes to the httpd.conf file for Apache?
 
My Websharing was unchecked, so that didnt do much for me.
Also i tried to load the page without the port number, and that didnt work either, it just said "Safari can’t find the server."

Any thoughts on this??

This is very frustrating, as everything looks like its working, but its not.... I still get "Direct Access to this location is not allowed." when i try to access php files... :(
 
Another thing to check is to see if there's any PHP error messages in the log file. It should be in /Application/MAMP/logs if I remember correctly. It may point out a clue if any errors are there.
 
Yes! Indeed, there was a php_error.log file there.
This is what is says:

[01-Oct-2008 14:37:05] PHP Notice: Undefined variable: mosConfig_absolute_path in /Applications/MAMP/htdocs/gk_business/index.php on line 23
[01-Oct-2008 14:37:05] PHP Notice: Undefined variable: mainframe in /Applications/MAMP/htdocs/gk_business/index.php on line 23
[01-Oct-2008 14:37:05] PHP Fatal error: Call to a member function getTemplate() on a non-object in /Applications/MAMP/htdocs/gk_business/index.php on line 23
[01-Oct-2008 14:37:08] PHP Notice: Undefined variable: mosConfig_absolute_path in /Applications/MAMP/htdocs/gk_business/index.php on line 23
[01-Oct-2008 14:37:08] PHP Notice: Undefined variable: mainframe in /Applications/MAMP/htdocs/gk_business/index.php on line 23
[01-Oct-2008 14:37:08] PHP Fatal error: Call to a member function getTemplate() on a non-object in /Applications/MAMP/htdocs/gk_business/index.php on line 23


But the problem is that its all the php files that i am trying to view, i can not access..... i am not sure of what the above says... to me it looks like some sort of an error handling of the code, but i might be wrong.
 
Looks like it's part of Mambo/Joomla!. I don't have experience with it so don't know that I can help. I found some search results, but nothing really helped.
 
I just uploaded a normal php file i made in Dreamweaver, and it displayed without any problems. Yes, its something with Joomla and now it all makes sense....

Thank you very much for clearing this up! I appreciate it. Now at least i know that MAMP works :)
 
Tried accessing the files without the :8888 and no go. I did try a html file and still couldn't find that.

My log from this morning -

[Thu Oct 02 08:23:41 2008] [error] [client ::1] script '/Applications/MAMP/htdocs/phptest.php' not found or unable to stat
[Thu Oct 02 08:24:45 2008] [error] [client ::1] script '/Applications/MAMP/htdocs/heredoc.php' not found or unable to stat
[Thu Oct 02 08:25:08 2008] [error] [client ::1] File does not exist: /Applications/MAMP/htdocs/temp.html

Yes, I did make changes to the httpd.conf file. I originallly tried to set all this up using the tutorial from David Powers web site.

I had to remove the # from Line 114. It was supposed to enable php 5 on my computer. Should I add this back in?????

Thanks,
Vicki
 
A thought I had was to check the file permissions make sure they're readable.

On a different note, I might recommend switching MAMP's default docs folder to your "Sites" folder, and placing all your html and php files there--this prevents you from having to copy things over whenever new versions of MAMP are released and keeps everything in one place. (Might not solve the problem, but it can't hurt).
 
You shouldn't have needed to edit the httpd.conf file to turn on PHP5. Go ahead and add that line back. If you open the MAMP control panel in the preferences there's a radio button to make the change. Be sure to restart the servers afterwords. It seems like a very strange problem. You're certain you're placing the files where you think you are?

If the above doesn't work we'll try to get some more info. Open Terminal (Applications/Utilities/Terminal). Then do the following commands:

Code:
cd /Applications/MAMP/htdocs
ls -ACFhl   [I]// that's a lowercase L at the end[/I]

Then copy and paste the results here.
 
Ok, added the # back. Restarted the servers.

Yes, MAMP is in the Applications folder, which has the htdocs folder and had everything in it.

No change.

Terminal said -

-bash: 1s: command not found
users-mac-pro-2:htdocs user$

not sure what it means though....

Tried redirecting to my websites folder - hd/Users/user/websites - but the browser couldn't find any pages in there either. Is there any special way I should type the above location? I tried http://localhost/phptest.php and http://localhost:8888/phptest.php and http://localhost/Users/user/websites etc

I have repair permissions previously, but did it again anyway.

The MAMP start page opens fine.

Vicki
 
Terminal said -

-bash: 1s: command not found
users-mac-pro-2:htdocs user$

not sure what it means though....

The first of the command is lowercase L then s, not number 1 s.

Is there any special way I should type the above location? I tried http://localhost/phptest.php and http://localhost:8888/phptest.php and http://localhost/Users/user/websites etc

I changed my server to accept port 80 and I don't enter the port number when entering URLs.
 
The Terminal said -

users-mac-pro-2:~ user$ cd /Applications/MAMP/htdocs
users-mac-pro-2:htdocs user$ ls -ACFhl //
total 382221
drwxr-xr-x@ 9 user user 306B 29 Jul 2002 Tid Bits/
-rw-rw-r--@ 1 temp admin 12K 28 Sep 19:43 .DS_Store
drwx------ 3 root admin 102B 5 Jun 08:48 .Spotlight-V100/
-rwxr-xr-x 1 root wheel 3.7K 25 Sep 2007 .SymAVQSFile*
drwxrwxrwt@ 3 temp admin 102B 5 May 13:53 .TemporaryItems/
d-wx-wx-wt 2 root admin 68B 5 May 13:56 .Trashes/
-rw-r--r-- 1 root admin 0B 23 Apr 21:07 .com.apple.timemachine.supported
-rw-r--r-- 1 user user 0B 30 Apr 13:31 .com.apple.timemachine.supported (from old Mac)
drwx------ 26 user user 884B 2 Oct 16:58 .fseventsd/
-rw------- 1 root wheel 512K 23 Aug 11:06 .hotfiles.btree
drwxr-xr-x@ 2 root wheel 68B 24 Sep 2007 .vol/
-rw------- 1 root admin 235B 28 Aug 2007 0828113107.001
-rw------- 1 root admin 235B 28 Aug 2007 0828120532.001
drwxr-xr-x@ 3 user user 102B 27 Aug 2002 Adobe Type Utilities/
drwxrwxr-x+ 127 root admin 4.2K 2 Oct 16:56 Applications/
-rw-r--r--@ 1 root admin 48K 28 Sep 20:18 Desktop DB
-rw-r--r--@ 1 root admin 1.6K 30 Apr 16:09 Desktop DF
drwxr-xr-x@ 21 user user 714B 16 Oct 2002 Desktop Folder/
drwxrwxr-x 3 root admin 102B 12 Jun 17:29 Developer/
drwxr-xr-x@ 10 user user 340B 12 Nov 2007 Documents/
drwxr-xr-x@ 8 user user 272B 3 Sep 2002 EPSON PhotoQuicker3.2/
drwxr-xr-x 4 user admin 136B 22 Jun 2005 EPSON STYLUS PHOTO R210 Series/
-rwxrwxrwx@ 1 user staff 200K 2 Sep 2002 FAXstf X 10.0.7 Updater Log.txt*
-rw-r--r--@ 1 user user 66K 16 May 11:59 Installer Log File
drwxr-xr-x@ 5 user admin 170B 2 Sep 2002 IomegaWare/
drwxrwxr-t+ 56 root admin 1.9K 29 Jul 14:08 Library/
-rwxrwxrwx@ 1 root admin 12K 21 May 17:56 MAU 1.1.2 Update Log*
drwxrwxrwx 3 user admin 102B 10 Feb 2003 MacJanitor.app/
drwxr-xr-x@ 5 user user 170B 24 May 2007 Microsoft/
drwxr-xr-x@ 2 root wheel 68B 21 Nov 2007 Network/
-rw-r--r--@ 1 root wheel 280K 14 Mar 2004 Norton FS Data
-rw-rw-r--@ 1 root admin 100B 14 Mar 2004 Norton FS Index
-rw-rw-r--@ 1 root admin 83M 14 Mar 2004 Norton FS Volume
-rw-rw-r--@ 1 root admin 83M 12 Mar 2004 Norton FS Volume 2
drwxr-xr-x@ 23 user user 782B 18 Sep 2002 PhotoImpression/
drwxrwxr-x 4 root admin 136B 14 May 17:10 Previous Systems.localized/
drwxr-xr-x 4 root wheel 136B 19 Sep 12:44 System/
drwxr-xr-x@ 4 user user 136B 9 Oct 2002 TheVolumeSettingsFolder (from old Mac)/
lrwxr-xr-x 1 root admin 60B 23 Apr 21:09 User Guides And Information@ -> /Library/Documentation/User Guides and Information.localized
-rw-r--r--@ 1 root admin 0B 4 May 2005 User Guides And Information (from old Mac)
drwxr-xr-x 6 root admin 204B 14 May 17:25 Users/
drwxrwxrwt@ 4 root admin 136B 2 Oct 17:27 Volumes/
drwxr-xr-x@ 40 root wheel 1.3K 19 Sep 12:41 bin/
drwxrwxr-t@ 2 root admin 68B 21 Nov 2007 cores/
dr-xr-xr-x 2 root wheel 512B 2 Oct 16:58 dev/
lrwxr-xr-x@ 1 root admin 11B 14 May 17:11 etc@ -> private/etc
dr-xr-xr-x 2 root wheel 1B 2 Oct 16:58 home/
-rw-r--r--@ 1 root wheel 9.8M 4 Sep 04:32 mach_kernel
-rw-r--r--@ 1 root wheel 10M 4 Sep 04:32 mach_kernel.ctfsys
dr-xr-xr-x 2 root wheel 1B 2 Oct 16:58 net/
drwxr-xr-x@ 6 root wheel 204B 14 May 17:14 private/
drwxr-xr-x@ 66 root wheel 2.2K 19 Sep 12:41 sbin/
lrwxr-xr-x@ 1 root admin 11B 14 May 17:11 tmp@ -> private/tmp
drwxr-xr-x@ 11 root wheel 374B 16 May 23:44 usr/
lrwxr-xr-x@ 1 root admin 11B 14 May 17:11 var@ -> private/var
users-mac-pro-2:htdocs user$

Does this mean anything?

I checked the console and it said -

2/10/08 9:27:11 PM [0x0-0x4c04c].com.living-e.MAMP[552] chown: /Applications/MAMP/logs/mysql_error_log: Operation not permitted
2/10/08 9:27:11 PM [0x0-0x4c04c].com.living-e.MAMP[552] Starting mysqld daemon with databases from /Applications/MAMP/db/mysql


Now MAMP can't find anything!!

I am getting so frustrated with this. I feel I have wasted lots of money on a book I can't use. I can't even open the downloaded files.

Is there another way??????????????????????

Vicki
 
You weren't suppose to add the // to the end of the command. That was to indicate the following text was a comment, which is a programming convention. Sorry it wasn't more clear. The resulting output was looking at your root folder, which won't help us.

Code:
cd /Applications/MAMP/htdocs
ls -ACFhl
* First and last character of 2nd line is a lowercase L

The console error message you shows is insinuating that there may be a permissions issue, which is what the above command will reveal for us as it tells us the permissions of each file in the directory.

For instance "-rw-------" means that you can read and write to the file, but no one else can. "-rwxrwxrwx" means everyone can read write and execute the file. Public files (like HTML files for people to go to) will have this last permission setup. So we'll see.

MAMP is the easiest way to get things setup, it just seems that book got you off track a little bit. It may have been referencing an older version of MAMP as well. Or if you're using a version of MAMP from the book you may want to download the latest version.
 
Thank you for being so patient with me :)

The terminal result -

users-mac-pro-2:~ user$ cd /Applications/MAMP/htdocs
users-mac-pro-2:htdocs user$ ls -ACFhl
total 8
drwxr-xr-x 12 user user 408B 1 Oct 22:04 phpsolutions/
-rw-r--r--@ 1 user admin 20B 30 Sep 17:27 test.php
users-mac-pro-2:htdocs user$

I repaired permissions yesterday before opening MAMP.

Vicki
 
-rw-r--r--@ 1 user admin 20B 30 Sep 17:27 test.php

OK, those permissions may be causing problems. The "Repair Permissions" doesn't take into account a web server. Lets do:

Code:
cd /Applications/MAMP/htdocs
chmod 777 test.php

Then try to access the test.php file.
 
HOORAY!!! The page opened.

What went wrong?

Is there anyway I can save the files to my website folder in my user folder instead of the MAMP htdocs folder?

What would the link be?

Thank you so much for your help and patience.

Vicki
 
HOORAY!!! The page opened.

What went wrong?

Is there anyway I can save the files to my website folder in my user folder instead of the MAMP htdocs folder?

What would the link be?

Thank you so much for your help and patience.

Vicki

Edit: (See memco's post below for the simpler solution. Forgot it was in preferences.)

Glad that worked because I was pretty much out of ideas after that. As far as changing the web site folder, open the httpd.conf file and search for a line that starts with DocumentRoot. This is the path you'll change. It'll currently be pointed at the htdocs path. You'll also need to change this line

Code:
<Directory "/Applications/MAMP/htdocs">
to have the same path as what you put for the document root. That should pretty well set you up, but just in case be sure to make a backup of the httpd.conf file so you can revert back if need be.
 
There's a setting to change the document root from within MAMP itself. Go to preferences->apache "Select" then choose your Sites folder.
 
Thank you so much. I have discovered it isn't easy to explain a problem, but your patience is amazing.

Also, thank you to everyone else that took part in helping.

Vicki
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.