Enabling php

Hi there, I am running into some serious issues with enabling the built-in PHP on Mountain Lion.
I have followed the steps described in an article that I have found through google. Everything were fine until I hit to the steps to enabling PHP service. Unfortunately, I serached through google to see if I can find a solution to it, and it turns out unsuccessful. So, keeping up with a little hope to see if one of your smart techs can solve my issue with PHP:
I have created a .conf file using my shortname as described in the article that I found on google. Everything went fine with localhost, but when I tried to access to http://localhost/~username then the headache message popped out stating that 403 forbidden. I tried to change access permission but turned out disappointed. Well, with no one can seek for help, my only hope is on you guys. Looking forward to get a good hand soon.

Hi, I am assuming you are trying to configure the httpd.conf file on your computer.
In OSX, by default when you enable Apache, the root folder is OSX HDD > Library > WebServer > Documents
Place a test html file or php file (e.g. something that displays the message 'Hello World') in that folder and open up Safari or any web browser of your choice and just enter http ://localhost/(your test file) in the address bar.  Does the test open and display whatever message it is supposed to show?
You can edit the httpd.conf file via terminal:
sudo nano /etc/apache2/httpd.conf
enter your administrator password
Scroll down the file and uncomment (delete #) for the LoadModule lines to enable the modules you want.
(The PHP module is near the end of that LodeModule list, just remove the # in front of the line to enable it.)
Scroll down more to the line that begins with DocumentRoot "/Library....  and change the root directory path to whatever you want.
(If you want to be able to open up http ://localhost/(your username) in a web browser, make sure that a folder with your username exists inside the root directory.)
Save and exit httpd.conf file by entering the following keyboard commands:
ctrl + o, press enter to save
ctrl + x
Don't forget to restart Apache after editing the httpd.conf file with this command in terminal:
sudo /usr/sbin/apachectl restart

Similar Messages

  • Enable PHP and apache!

    Hello,
    Is there a simple way to enable php and apache on my new imac? So I can test my website locally. Hopefully its not a lot of steps. I have seen a lot of tutorials by using google. But they involve terminal and I don't know that well to be able to mess with it. I don't want to ruin my computer. So any help would be appreciated.
    Thanks,
    Kash_Money

    And to answer your first question, "how can I use a .html extension page" see http://discussions.apple.com/thread.jspa?messageID=5850167&#5850167
    which is, however, for Tiger. On Leopard, the relevant file is /etc/apache2/httpd.conf and it turns out that /etc/apache2/other/php5.conf is even more relevant for exactly what you want.
    Specifically, first read the first paragraph therein for why you should do something else instead. However, the hopefully not too crazy instructions (sorry, but the only way I know how uses the Terminal and emacs, so due to your Terminal-phobia I'll give detailed instructions and hope I'm not insulting you too much), will be for what you want, not for what I think you should do. The Terminal+emacs instructions are needed because /etc/ is a hidden directory owned by root, which makes it hard to use TextEdit to edit it.
    So open a Terminal , and type
    sudo emacs /etc/apache2/other
    emacs is a text editor that works inside the Terminal, and which, for the uninitiated, has weird key bindings. You'll probably see something like
    <pre style="background: #eee">
    <IfModule php5_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    <IfModule dir_module>
    DirectoryIndex index.html index.php
    </IfModule>
    </IfModule>
    </pre>
    Press the down arrow key, ctrl-e, and type " .html". The file contents should now look like
    <pre style="background: #eee">
    <IfModule php5_module>
    AddType application/x-httpd-php .php .html
    AddType application/x-httpd-php-source .phps
    <IfModule dir_module>
    DirectoryIndex index.html index.php
    </IfModule>
    </IfModule>
    </pre>
    Type ctrl-x ctrl-s to save, and then ctrl-x ctrl-c to exit.
    Restart the web server, either by typing
    sudo apachectl restart
    or by going into System Preferences and unchecking, then checking web sharing.

  • How to enable php

    I am trying to enable php on my macbook with Lion 10.7.  I have found and changed the http.conf file, but I can't save the changes.  My computer tells me I don't have permission, but it doesn't give me any pop up to confirm my permission.  Can anyone help.

    Well, first make sure that you are accessing the PHP through the browser with an URL that begins with 'http' or 'https'. If you access it through Finder, or opening it directly in your browser, the web server (that would normally process the PHP script), is completely bypassed.
    If that's not the issue, open Terminal.app. Type
    grep -i php /etc/apache2/httpd.conf
    The result should be
    {quote}
    LoadModule php5_module libexec/apache2/libphp5.so
    {quote}
    If you see a '#' at the beginning of the line, the PHP module was disabled. You need to edit /etc/apache2/httpd.conf and remove the '#' (in the terminal, type 'sudo nano /etc/apache2/httpd.conf').
    While you are at it, also do
    grep -i apache2/other /etc/apache2/httpd.conf
    ... and if it doesn't look like this
    {quote}
    Include /private/etc/apache2/other/*.conf
    {quote}
    Edit the file and add that line.
    If that's OK, then type
    cat /etc/apache2/other/php5.conf
    That should look like this
    {quote}
    <IfModule php5_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    <IfModule dir_module>
    DirectoryIndex index.html index.php
    </IfModule>
    </IfModule>
    {quote}
    ... if not, edit that file and make it look like it is above. Once all that is done, go to System Preferences, click on the Sharing icon, and uncheck Web Sharing, then check it again a couple of seconds later (to restart the web server).

  • Enabling php on this Mac OS X 10.6.6

    PHP version 5.3.3 seems installed.  But when I attempt to open php pages the browser opens them as text.  It seems that I must edit the httpd.conf file to actually enable php.  I changed the permissions on the file with sudo chmod ug+rw for httpd.conf.  TextEdit still doesn't allow me to change it.  It's saying that I don't have permission to write to that folder.  I changed the permission the /etc/apache2 and that didn't  help.  What must I do to be able to modify httpd.conf and enable php support?

    Welcome to Apple Support Communities.
    , System Preferences, Internet & Wireless, Sharing
    You many need to click the padlock at the bottom and enter the admin password to unlock Sharing so you can make changes.

  • Enabling PHP is breaking Apache.

    I am following the tutorial at, http://developer.apple.com/mac/articles/internet/phpeasyway.html, to enable apache/mysql. Where the tutorial is titled, "Enabling PHP in Apache", I copy and pasted the code to terminal. Osascript password prompted and I entered. When the script finished, I can't access "my computers website", as it just returns as busy/not found. For some reason the Mac HD: private: etc: apache2: httpd.conf file (the copy) is created, but is completely blank. When I replace it with the original, I can access "my com website" again.
    Also. The httpd.conf file does not have a line "#LoadModule php5_module libexec/apache2/libphp5.so".... so there is nothing to toggle?
    Can I just edit that file manually to enable Php?
    Message was edited by: thejackkelly

    Solved with new php install.

  • How do i enable php on my mac

    I would like to enable php on my mac (and apache if necessary).
    It needs to be simple.
    I can do this on a pc (with XAMP).
    I have some development with php to do?

    actually there are no cookies on mac's. only got CACHES:
    go to Finder
    choose Go (menu bar)
    hold OPTION Button (keyboard)
    choose Library
    choose Caches

  • Enable PHP on osX 10.4.10

    I'm a newbie so bear with me.
    I have an iMac osX 10.4.10
    I want to run Gallery 2 on the local server on my computer to set it up.
    I used MAMP. Easy. It shows green lights for Apache Server and MySQL server using PHP 5. Great!
    Now I need to Enable PHP. I found this:
    http://docs.info.apple.com/article.html?artnum=107292
    "For 10.3 or later
    Open Server Admin.
    Select the Web service from the desired server in the Computers & Services list.
    Click on Settings.
    Click Modules.
    Enable or disable the php4_module as desired.
    Save the changes.
    Restart the Web Service."
    I downloaded Server Admin and started it.
    My local address is http://myname.local/
    Server Admin says, "There is no server available at the address you entered.
    All services failed to access the address you provided for myname.local. Check the address and try to log on again or contact your network administrator.
    All I want to do is activate PHP...that's it!
    The directions in the above link are NOT for osX 10.4.10...So now what do I do?
    Thanks
    Tim

    Are you using Mac OS S Server?
    You posted in the Server forum. Server Admin is geared to managing Mac OS X Server and can't help you with the client version of the OS.
    To enable PHP on the client version of Mac OS X you're going to have to manually edit /etc/httpd/httpd.conf and uncomment the lines:
    LoadModule php4_module libexec/httpd/libphp4.so
    AddModule mod_php4.c

  • Enable PHP Imap Extension on Lion Server (I Willing to Pay for the Service)

    Can anyone teach me or know how to enable PHP Imap extension on my Lion 10.7 server?
    I willing to pay for the service fee for this.
    Kindly contact me asap [email protected], I need my server to have this feature as soon as possible.
    I found a several blogs for this but still can't get it work exactly.
    Thanks a millions!
    Jack

    I also want IMAP support in PHP on Lion Server.
    I found the tutorials below:
    http://www.september28.co.uk/blog/2011/11/24/php-imap-support-in-mac-os-x-lion-w ithout-recompiling-php/
    or
    http://blog.xeonxai.com/2009/12/03/160/
    but honestly, with my limited knowledge of the command line and php installation, it's almost like trying to read chinese. I could probably follow the instructions, but if anything went wrong I'd be completely lost and I wouldn't know how to get back to square one. Looking for a "dummies" guide...

  • How to enable php, mysql, and apache?

    Hi guys, I am sorry if I am not in the right forum, but I am really worried about my problem...
    According to this article("http://developer.apple.com/mac/articles/internet/phpeasyway.html") I already have php , apache, and SQlite installed on my mac. My problem is when I try to enable the apache, instead of coming a localhost ( like 128.1.2.1) comes my website " your computer's website: http://nunomedi-e14....lan/ ) I donn't know what is this, I replace the index.html with index.php in sites folder.
    Can somebody help me please.

    Please look at my second post. I corrected what I said:
    macwiz1220 wrote:
    O wow. I'm sorry. I have no idea where i got that from. The file you want is in /etc/apache2/httpd.conf and the line you are looking for is *#LoadModule php5_module*
    Take a look at this article on LAMP on Leopard.

  • How do I enable php in OSX 10.9.3

    I downloaded webserver and have a apache and mysql and the site is working when i connect but only the html pages, the php pages dont work and i noticed the webserver says PHP is disbaled how do I enable the PHP?

    Look here....
    http://support.apple.com/kb/PH15645

  • How to enable php ziparchive extension in solaris 10

    Hi,
    I have to enable php_zip.so extension for my phpexcel .How could i do this without re configure php ?

    If the extension=zip.so line is not in php.ini file then you must configure php to accept this extension and restart the webserver.

  • Getting error after enabling php in httpd.conf

    Hi,
    I want to get php enable on the Apache web sever that is part of OS 10.6.1. I read the docs and uncommented the Load line for php in httpd.conf. Then I restarted the web server. Now when i try to access via Safari a phpinfo( ); command as part of a simple .php file, I get the following error:
    Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
    Fatal error: Unknown: Failed opening required '/Users/mobilemojo/Sites/phpinfo.php' (include_path='.:/usr/lib/php') in Unknown on line 0
    Is there something else that has to be modified to get php module to load?
    Thanks in advance!
    K

    Hi Sridhar,
    Please compare the DTS settings on the Windows 7 computer and the Windows Server 2008 R2 computer and make sure they are identical.  Make sure the “Allow Inbound” and “Allow Outbound” options are check, and pay attention to the authentication mode as
    well.
    Besides, make sure both Distributed Transaction Coordinator (TCP-In) and Distributed Transaction Coordinator (TCP-Out) rules in Firewall are enabled.
    If the issue persists and there are any security/anti-virus software, temporarily disable the security/anti-virus software and check the issue again.
    Regards,
    Mike Yin
    TechNet Community Support

  • Can not enable PHP support for project...

    Hello All,
    I can create a Flex/PHP project but when I go to the project - Properties - Flex/PHP Support I get the following message "The currently displayed page contain invalid values" and the page never opens - which makes it impossible to see said values.  OK, right click on project, go to 'add/change project type' and change to a flex project.  Go back to 'add/change project type' and select 'add flex and php project type', which shoots you back to  Properties - Flex/PHP Support page.  Now I've got the fields available for editing, but no combination of values or the order in which I submit them will validate???  I'm running Flash Builder as root and I recieve this command line output everytime try to validate or select a project via the "PHP Project name:' drop down list:
    !ENTRY org.eclipse.ui 4 0 2011-06-30 21:00:37.186
    !MESSAGE Unhandled event loop exception
    !STACK 0
    java.lang.NoSuchMethodError: java.lang.String.isEmpty()Z
    at com.zend.php.flashbuilder.ui.propertypages.PHPSupportPropertyPage.f(PHPSupportPropertyPag e.java)
    at com.zend.php.flashbuilder.ui.propertypages.PHPSupportPropertyPage$8.handleEvent(PHPSuppor tPropertyPage.java)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1371)
    at org.eclipse.swt.widgets.Text.setText(Text.java:1891)
    at com.zend.php.flashbuilder.ui.propertypages.PHPSupportPropertyPage.c(PHPSupportPropertyPag e.java)
    at com.zend.php.flashbuilder.ui.propertypages.PHPSupportPropertyPage.b(PHPSupportPropertyPag e.java)
    at com.zend.php.flashbuilder.ui.propertypages.PHPSupportPropertyPage.a(PHPSupportPropertyPag e.java)
    at com.zend.php.flashbuilder.ui.propertypages.PHPSupportPropertyPage$6.widgetSelected(PHPSup portPropertyPage.java)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1187)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3622)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3277)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
    at org.eclipse.jface.window.Window.open(Window.java:801)
    at com.zend.php.flashbuilder.ui.actions.PHPAttachAction.run(PHPAttachAction.java)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionI tem.java:584)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java :411)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1187)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3622)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3277)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at com.adobe.flexbuilder.standalone.FlashBuilderApplication.start(FlashBuilderApplication.ja va:108)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLau ncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.jav a:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
    Thanks for your help in advance!

    Hello Sudhir,
    Thanks for your help; the problem is fixed.  I believe your suggestion targeted the source of the issue, but I ended up upgrading my OS so it's really hard to say.  Also, I'm running the standalone version of FB for PHP.
    For any interested folk:
    - first I updated Java on my machine but the no luck... got this:
    XXX:~ jh$ /Applications/Adobe\ Flash\ Builder\ 4.5/Adobe\ Flash\ Builder\ 4.5.app/Contents/MacOS/Adobe\ Flash\ Builder\ 4.5
    JavaVM: Failed to load JVM: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bundle/Libraries/libserv er.dylib
    JavaVM FATAL: Failed to load the jvm library.
    - for a test, I installed Flash Builder on a 10.6 machine and there were no issues
    - upgraded my machine to 10.6, Flex/PHP support works
    Seems like the apple distribution of Java 1.6 is either different between 10.5 and 10.6 or my install of Java 1.6 was faulty; someone knows, just not me.
    Thanks again for your help!
    J

  • Enabling PHP In Apache

    Hi, I just got a macbook, and am trying to setup PHP on it. I have tried following all the tutorials on google where it says to uncomment all the lines regarding PHP, then press wq: or whatever to save and quit, but then every time I make a simple php script, it just echos back the text from the php script. for example when the php script says "<?php echo date(Y); ?>" it just prints "<?php echo date(Y); ?>" when I go to my IP. What am I doing wrong?

    Did you go to Marc Liyanage's site? He has made some great install packages, especially if you are going to use MySQL with PHP.
    http://www.entropy.ch/software/macosx/

  • Apache enable php

    Every time I upgrade my iMac with a new MacOS, I restart at the stone age.
    What a boring system.
    Every time my iMac loses the hostname, and apache on local files is unable to manage php files.
    What a boring system.
    In this community, if I select the Mountain Lion folder and then I search for apache anable php, the search engine show me articles related to 10.5, 5 years old, totally useless.
    What a boring system.
    Now, I have to solve a css problem in a web page and cannot even start to see the page locally, since my iMac is totally unable to do what I expect as assumption, seen that it worked for years.
    This system is really, really boring.
    Does someone give me a link to a useful page on how to configure these boring things?
    Thank you!

    Try Google:
    https://www.google.com/webhp?client=safari#hl=en&client=safari&sclient=psy-ab&q= mac+mountain+lion+configure+apache+php&oq=mac+mountain+lion+configure+apache+php
    That was so easy it's boring.

Maybe you are looking for

  • Read-only mode. Object is currently locked by user: J2EE_ADMIN. hw 2 unlock

    Hi friends, <b>i am not able to edit my object in EP</b> , it says Read-only mode. Object is currently locked by user: J2EE_ADMIN. how do i unlock it ? i am on 04s SP9

  • Can i add an extra hard drive to my laptop?

    I have a HP Pavilion g7-1219wm Notebook PC and i was wondering if there was room for an extra hard drive ? I'm thinking about maybe getting a 1 TB hard drive and run Win 8 on it and run Win 7 on the hard drive thats in it now because some of my apps

  • Correct procedure to update IOS IPS signatures on 2911 router

    What is the correct procedure to update the IOS IPS signatures on an 2911 router? I know how to download the signatures file (eg. IOS-S556-CLI.pkg) but what is the correct way to install the update? Thank you in advance!

  • Recording computer's audio out

    I'm trying to figure out a way to record an audio file that's streaming from the internet. I'm using Logic 7.2 with a Presonus Firebox. Can I just run the main outs from the Firebox into inputs 1 and 2?

  • Memory_management BSOD

    Hello! It has been a month now, and i constantly receive memory_management BSOD's. Not to mention that my Windows R(8) Hd graphics driver crashes occasionally. I do not know if these are related in any way. I have posted a DUMP file, for review so th