moriahcgibbs Posted November 12, 2012 Share Posted November 12, 2012 I cant figure out what im doing wrong. Ive tried using a MAMP server but the only way my PHP documents would run is when i would open them through Netbeans, witch was really a pain. If i tried to open them in a browser without going through Netbeans they would always come out as plain text. I cant seem to uninstall MAMP for some reason and so I cant just use the PHP server already installed on macs. Its really frustrating. Im thinking pf just wiping my computer and starting over. I think something that I perviously downloaded is causing this but i cant figure out what. Am I just making some obvious mistake or could there be something else wrong? All I need is a private server for developing purposes. 1 Link to comment Share on other sites More sharing options...
thescientist Posted November 12, 2012 Share Posted November 12, 2012 MAMP works fine on OSX without having to use Netbeans. Some obvious questions to that point are1) did you follow the installation isntructions correctly?2) are saving your files in the Applications/MAMP/htdocs folders?3) are you accessing the files ovrer localhost?4) did you make sure to start MAMP and confirm that Apache is running? Aside from that, an AMP stack is installed natively in OSX, but takes a little more work and configuration to get up and running. And you don't have uninstall MAMP to get the native Apache and PHP to run. Just make sure Apache on MAMP is not running. Link to comment Share on other sites More sharing options...
moriahcgibbs Posted November 12, 2012 Author Share Posted November 12, 2012 1) I followed the instructions on the MAMP website exactly2) I saved all of my php documents in the htdocs folder3) to run the files all i did was copy their file location into a web browser, but Im pretty sure i was doing something wrong there, but I couldnt find out anything by just googling it. 4) I did start MAMP and confirm that Apache was running. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 12, 2012 Share Posted November 12, 2012 The URL in the browser needs to start with HTTP, if it doesn't then you're not going through Apache and it's not going to run the PHP code. The domain for your computer is localhost, so start with http://localhost/ and go from there. Link to comment Share on other sites More sharing options...
thescientist Posted November 12, 2012 Share Posted November 12, 2012 (edited) 3) to run the files all i did was copy their file location into a web browser, but Im pretty sure i was doing something wrong there, but I couldnt find out anything by just googling it. 3) are you accessing the files ovrer localhost?This probably your problem http://documentation...amp/first-stepsThe web server starts by default on port 8888. This port must be specified when calling the local web page in the browser, e.g.: http://localhost:8888!The benefit of MAMP is to run Apache (amongst other things), which is a web server. PHP runs as an Apache module. So you can't just open PHP filles over the filesystem. Your browser needs to have the address http://localhost:8888 when you want to run your PHP scripts although a little harder to find in their docs is where your files need to go. in the folder /Applications/MAMP/htdocs/, put a php file with just these contents in itindex.php<?phpphpinfo();?> And in your browser try the address http://localhost:8888/ and you should see a bunch of PHP info display on the page Edited November 12, 2012 by thescientist Link to comment Share on other sites More sharing options...
moriahcgibbs Posted November 13, 2012 Author Share Posted November 13, 2012 Now my server will not start at all. I think there is another issue with the download I just dont know what it is. I tried to uninstall and re install MAMP after it stopped working, but now the My SQL server will not start at all. only the Apache server will start. I cant figure out whats wrong with it. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 13, 2012 Share Posted November 13, 2012 Check the logs. http://www.google.com/search?client=opera&rls=en&q=mysql+error+logs&sourceid=opera&ie=utf-8&oe=utf-8&channel=suggest Link to comment Share on other sites More sharing options...
moriahcgibbs Posted November 13, 2012 Author Share Posted November 13, 2012 Ive just uninstalled MAMP and am going to use the php server already installed on OSX by uncommenting lines in the httpd.conf file. However, when i run a script in a browser it still comes out as plain text. Im saving the files under MacintoshHD/Library/webserver/documents but they still wont run properly. I think Im probly making some really obvious mistake i just dont know what. Link to comment Share on other sites More sharing options...
thescientist Posted November 13, 2012 Share Posted November 13, 2012 (edited) Apache isn't just going to be able to guess where it needs to run. For this i have virtual hosts setup for all my local sites, so in /etc/hosts, I'll have something like this for each site 127.0.0.1 my-site.local and in my /etc/apache2/extra/httdp-vhosts.conf, I have this for each site <VirtualHost *:80> ServerName "my-site.local" ServerAlias "www.my-site.local" DocumentRoot "/Users/thescientist/Documents/workspace/my-site/webroot/" ErrorLog "/private/var/log/apache2/my-site.local-error_log" CustomLog "/private/var/log/apache2/my-site.local-access_log" common</VirtualHost> I also make sure in the same file that Apache has access to my workspace folder, like this <Directory "/Users/thescientist/Documents/workspace/"> Allow From All AllowOverride All</Directory> then, I test everything first $ sudo apachectl -t restart apache $ sudo apachectl restart and hit this in my browserhttp://my-site.local Edited November 13, 2012 by thescientist Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now