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.

Similar Messages

  • PHP and Apache, Bah Humbug

    Setting up PHP and Apache, I was following this: http://developer.apple.com/mac/articles/internet/phpeasyway.html
    I did the step to turn on "web sharing", and the "your computers website" link opened up the local page no problem. When I copy and pasted the content in "enabling PHP in apache" to terminal, I thought it worked... but now neither of the links work. Both say something like "Firefox can't establish a connection to the server at....". Any ideas?

    Safari says this:
    Safari can’t connect to the server.
    Safari can’t open the page “http://192.168.1.100/” because Safari can’t connect to the server “192.168.1.100”.
    I tried restarting apache with "sudo /usr/sbin/apachectl restart", but no luck, still get same messages in browsers.
    The computer's site (not personal) DID work when I started following the tutorial, but I only got half way through. I believe it stopped working when I copy/pasted the part from the tutorial. Any ideas? Can I completely reboot the process somehow?

  • Upgrade PHP and Apache on 10.6.8

    I'm thinking of upgrading PHP and Apache that were installed as part of 10.6.8 (Snow Leopard) to their current versions.
    How do I do it?
      - nello

    I posted links for creating a Macintosh, Apache, MySQL, PHP (mamp) stack on delicious:
    http://www.delicious.com/nlucchesi/tag_bundle/mamp

  • PHP and Apache

    I have installed XAMPP for Mac OSX so that I can work on PHP and mySQL projects at home. It has installed correctly and http://localhost connects me to the server and the XAMPP pages. I am using Eclipse for my web pages and these files are in Users/Me/Sites/workspace2/homework/ .
    The DocumentRoot in the httpd.conf file is "/Applications/xampp/xamppfiles/htdocs"
    What is the correct path to see my files? I was trying http://localhost/Users/etc but it says not found on the server. I don't know if I have a setup problem or I am just using the wrong file path to see my files.

    bronisaurus wrote:
    I have installed XAMPP for Mac OSX so that I can work on PHP and mySQL projects at home. It has installed correctly and http://localhost connects me to the server and the XAMPP pages. I am using Eclipse for my web pages and these files are in Users/Me/Sites/workspace2/homework/ .
    The DocumentRoot in the httpd.conf file is "/Applications/xampp/xamppfiles/htdocs"
    What is the correct path to see my files? I was trying http://localhost/Users/etc but it says not found on the server. I don't know if I have a setup problem or I am just using the wrong file path to see my files.
    Are you asking where to put the PHP files you create? Or if you should change the path in the http.conf file? Either one should get you what you desire. You can either start putting your PHP and HTML files in /Applications/xampp/xamppfiles/htdocs or change the DocumentRoot in the XAMPP httpd.conf file to Users/Me/Sites/workspace2/homework.
    If you do the latter, don't forget to stop and restart XAMPP, or at least the Apache server part of it. The Apache config file is only read when it starts up...
    Post back if any of that's not clear.
    charlie

  • 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/

  • 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 i can connect php and oracle9i ?

    hello am new to php.i have oracle 9i and php and apache.oracle is installed at one system and php inother one at network .when i have at same pc's i connect it.but now it's at different systems how i can connect.plzz tell me complete steps of apache that i will define and next complete process to connect php and oracle .plzzzzzzzzzzzzzzzzzzzzzzzzzzzz

    Apache and PHP need to be on the same system. That system also needs either the database or Oracle client libraries like Oracle Instant Client. There are steps for installation of the PHP side on http://www.oracle.com/technology/tech/php/index.html
    There are various Oracle installation notes in the Oracle manuals or software bundles.
    -- cj

  • Snow Leopard, PHP, MySQL, Apache and Wordpress!

    Hi there,
    It's taken me most of the day to work this out, so I thought I should post about it somewhere and here, on the Apple forum, is the ideal location.
    I'm a web developer and love the fact that my MacBook works out of the box with a Unix webserver and with little effort, I was able to set up PHP and MySQL on it. I was delighted to hear that the new Snow Leopard was shipping with the latest and greatest of both. It wasn't quite that easy when it came down to running my test sites, one of which I'm working on is a Wordpress site. Far from being daunting, the solutions to the problems I had were quite simple. The issues arose from the OS not having much exposure yet and not many people having posted their experiences on the web. It was just time consuming.
    I should mention at this point that this does require some tinkering with Terminal, but not so much as to cause damage if you do something wrong.
    First off Apache. Thankfully this is as stable as it always has been. All this requires to activate it is to visit System Preferences > Sharing and switch on Web sharing. Bish-bosh, job done.
    Next off PHP. If you open a Safari window and run your phpinfo.php file (where ever you have it saved. If you don't, they're out there, it's a tiny piece of code which you can use to find out your current php setup). You'll find that everything is superb! PHP 5.3! Excellent! Hang on, scroll down to the date and time section. Whoa! What's this big fat warning here.
    That warning my friend, has been the bane of my misery all day. Wordpress hates it. HATES IT! It causes no end of grief. So what's the multi step, multi program solution?
    Open your php.ini file and add the line:
    date.timezone=Country/City
    (do a Google search for PHP Timezones and you will get the exact settings. It's not so good that it understands every city in the world. My setting was Europe/Dublin).
    That's all. This will solve your issue of the timezone error everywhere. Stop and start Apache (System Preferences > Sharing, tick off and tick back on Web Sharing) and hey presto, error is gone.
    Wait a minute, where the **** is my php.ini file. Unfortunately this is where you have to get your hands dirty. Your php.ini file is a system file which resides in the /etc/ folder. Open a terminal window and type exactly the following:
    cd /etc/
    cp php.ini.default php.ini
    This makes the php.ini file from the default. This protects the original so if you ever need to create a new copy or if you make a mistake in the next steps, you can start again.
    Next I'm going to tell you how to edit this file. This uses a program called vi (there are GUI editors out there that will save you this heartache, so if anyone knows any, please post in response. I think TextWrangler is one).
    First you need to set the php.ini file so you can edit it. Type in exactly as follows:
    sudo chmod 777 php.ini
    Sudo is the superuser commmand. It may not be needed, but stick it in anyway. If you are asked for a password, put in your normal password (that you would be asked for say if you were installing something you downloaded).
    At the next prompt, type in:
    vi php.ini
    This will open the php.ini file. Using the up and down keys, find a blank line in the file. You will notice that alot of the lines start with ';'. These are commented lines. Once you find a blank line, press 'i' to insert text. Your screen will now say '-- INSERT --' at the bottom in red. Type the following in exactly (you will NOT be able to cut and paste):
    ; Set PHP Default Timezone
    date.timezone=Europe/Dublin
    Substitute "Europ/Dublin" with your own timezone. When you are done, press escape. Now type in the following:
    :wq!
    The colon is important (not a typo on my part) as this tells vi you are going to run a command. You should now be back at your prompt. Now you need to reset the permissions on the file. Type the following:
    sudo chmod 444 php.ini
    And that's it. That's your PHP setup and finished. If you run your phpinfo.php file now, you should see your timezone under the date and time where you were getting the error before.
    Now the MySQL. This is a bit of fun because, even though MySQL ships with the system, it's not exactly set up correctly! So once again into terminal.
    This time go to the local directory:
    cd /usr/local/
    If you type in:
    ls -al
    You'll get a directory listing. This has the MySQL folder listed as mysql-5.0.77-osx10.5-x86 (or something! I did that from memory!). This IS the MySQL folder but if you, like me, had previously set the MySQL Preference Pane in your System Preferences, then it won't be able to access this. Type the following command:
    sudo cp -R /usr/local/mysql* /usr/local/mysql
    This should copy everything into a folder called mysql. It takes a couple of seconds (first time on my machine it was a good 20 seconds) to run so be patient. Now you need to do the following:
    sudo chown mysql:mysql /usr/local/mysql
    This sets the owner and group of the mysql files to 'mysql'. If you go back to your MySQL preference pane in System Preferences, you should now be able to start it (something weird about it makes it require to close and reopen the System Preferences window before it can open the MySQL pref pane. This is normal, just click ok).
    The bit that got me here, is that I thought that my activation of the MySQL was actually a new install. I tried everything to change the root user and password for MySQL but in fact, if you had it installed on Leopard, prior to upgrading to Snow Leopard, all your users and passwords are the same. If you HAVEN'T installed it before, I recommend you read the Post Installation Customisation (section 2.3) on the manual for MySQL 5.1 on http://www.mysql.com
    So that's about it. All that remains is to test Wordpress. I have phpmyadmin installed (I've heard CocoaMySQL is very good, like iTunes for db's so I'm gonna check that out later) and was able to create the new wordpress database. I changed the settings in the wp-configure.php file to match my setup but nothing worked. I changed the host from '127.0.0.1' back to 'localhost' (a common complaint of the wordpress setup) but no joy. Then I changed the host back to '127.0.0.1' and added the port :3306 (so the full host is '127.0.0.1:3306') and bingo, the install worked, my database setup and my test site worked.
    So that's it! Many of you out there will say, why didn't you just use MAMP. I did use MAMP, but I also got the Timezone issues and it took far more tinkering and hacking to make it work. I decided that, as my lovely MacBook now running lovely Snow Leopard had the lovely newest versions of PHP and MySQL installed, I'd rather get them working than use a runaround with MAMP. I'm a happier camper for it.
    I hope this helps some of you out there. I don't personally have a blog yet, but when I do, I'll post this up there for all to access. I may even add screen shots!!! But seriously, I hope this helps you all out with your installs. It's so handy to have all this stuff straightaway with Snow Leopard, it's just a matter of getting it to work.
    All the best now,
    T

    Hmmmm... I did a clean drive install of Snow Leopard because I used to do it once a year with Windows and hadn't done it in 3 with my MBP.
    First, my httpd.conf file had the line enabling PHP commented out, so when I went to see my simple file with phpinfo(), I saw the source. Saw your post, thought it was the timezone, fixed that (which will probably make wordpress happy when I get it running), and it still didn't work. Looked at the httpd.conf file, found that PHP was disabled by default, fixed that line, restarted the server, and my phpinfo() worked like a charm.
    Also if you want to edit config files, I use TextWrangler's "open hidden files" option.
    But... I have no /usr/local directory at all. Doesn't exist on my machine. Checked the options in the base install and MySQL isn't offered as an option. Checked the optional installs and MySQL isn't there. Even letting spotlight search for hidden files, the only files with MySQL in their name were from php scripts in my web folders.
    There's some stuff about installing/compiling from source.
    http://hivelogic.com/articles/compiling-mysql-on-snow-leopard/
    Dunno if I want to go down that road quite yet.

  • Coolstack: Difficulty enabling cURL and Tidy in PHP

    Hello:
    I've been trying to enable curl and Tidy in PHP. I was successful in getting curl running by adding the following to php.ini:
    extension="curl.so"
    However, after restarting Apache, I was seeing a warning in error_log that indicated libcurl.so.3 could not be found. I was able to locate a version of this file in /opt/staroffice8/program/libcurl.so.3, and after I copied it to /usr/lib, curl worked fine. Not an ideal fix, but I could not locate libcurl.so.3 in any download repository on sun.com.
    Interestingly, I noticed that phpinfo() indicates that curl is already compiled into PHP 5 - here's an excerpt from my PHP configure command:
    './configure'
    <snip>
    '--with-curl=shared,/opt/coolstack'
    It seems like I'm going about this wrong. On a related note, I also want to enable Tidy, and did so by adding the following to php.ini:
    extension="tidy.so"
    Again, this caused apache produce a warning in error_log looking for libtidy-0.99.so.0, and again, I have the following in my PHP configure command:
    './configure'
    <snip>
    '--with-tidy=shared,/opt/coolstack'
    Any insight into enabling these extensions would be greatly appreciated.
    Dave

    Open /etc/php/php.ini and find this:
    ; available extensions
    ;extension=bcmath.so
    extension=bz2.so
    ;extension=calendar.so
    extension=curl.so
    Make sure curl.so is uncommented.  If it's not, change your config then restart the webserver.
    Last edited by Endperform (2008-06-29 21:35:16)

  • Trying to get Apache, PHP and MySQL up and running

    I have just bought a new MacBook and I want to set up Apache, PHP and MySQL in order to create a local mirror of a website I have in my 'Sites' folder.
    I fall at the first fence!! To get Apache, I switch web sharing on in System Preferences' and I get the green light. When I click the links for personal website or computer's website I get a "Safari can't connect to the server" message.
    Any ideas what I should do now?

    Stephen Dancer wrote:
    Any ideas what I should do now?
    You will need to make some change to the index file in your Sites directory in order to enable Apache for that directory.
    You will have to enable PHP in the Apache config file at /etc/apache2/httpd.conf
    For MySQL, you will have to install it, and then fix it. You'll want to remove the StartupItem it wants to use and replace it with a launchd file. This discussion has a good roundup of the very latest tricks to get MySQL up and running with the latest security updates.

  • Ssh, sshd, and Apache Enable OpenSSL pkcs11 Engine by Default on T4, T4+ Platforms (18762585, 18764604)

    Hi,
    so I followed the advice in ssh, sshd, and Apache Enable OpenSSL pkcs11 Engine by Default on T4, T4+ Platforms (18762585, 18764604) - Oracle® Solari… and turned off UseOpenSSLEngine in /etc/ssh/sshd_config (Solaris 11.2 x86, AES-NI capable Intel CPU)…
    Now dtrace shows me this:
    root@sol112:~# ps -ef | grep ssh
      raider 18807 18806   0 03:02:43 ?           0:00 /usr/lib/ssh/sshd
    root@sol112:~# dtrace -n 'pid$target:::entry { @[probemod, probefunc] = count(); }' -p 18807
      libcrypto.so.1.0.0                                  AES_encrypt                                                  481299
      libcrypto.so.1.0.0                                  _sse_AES_encrypt_compact                                     481299
      sshd                                                ssh_ctr_inc                                                  481299
    Honestly, I was expecting AES-NI and not SSE calls… Could someone please tell me what's wrong?
    root@sol112:~# nm /lib/openssl/default/libcrypto.so.1.0.0 | grep -i aesni
    [1302]  |   1406040|        52|OBJT |LOCL |0    |21     |aesni_128_ctr

  • Upgrading to PHP 5 on Tiger and Apache 1.3

    I need a little help with configuring php on my local server. I love XHTML/CSS and a bit of php, WordPress, and Rails - but I'm terrible at this server stuff. I'm petrified of screwing my configuration.
    I'm running everything from the default OS X Apache server (I'm on Tiger OS X 10.4.10). I prefer using the internal server to all-in-one apps like MAMP and Locomotive. I have phpMyAdmin v2.10.2, MySQL v5.0.24a, and I think I'm running php 4.4.7 (typing php -v whilst in my document root in terminal returns version 4.4.7).
    I now want to use the latest version of php. However, I can't remember if I upgraded php when I was installing MySQL etc. If not, is it possible that I installed the latest version, and I'm just not using at the moment (which could be why terminal is saying it's version 4.4.7)? Is there anyway to check for dormant versions of php or to switch over to running a different version?
    If I don't have it, I need to install it. Is there an easy way of doing this via an installer? Is there anything I need to watch-out for whilst I'm attempting this feat?
    Also, does Leopard bring many advancements on the server front, i.e. Apache 2, php 5, MySQL etc, which might save me some hassle if I just go through the inevitable OS upgrade sooner rather than later?
    Any help is much appreciated.

    I now want to use the latest version of php. However, I can't remember if I
    upgraded php when I was installing MySQL etc. If not, is it possible that I
    installed the latest version, and I'm just not using at the moment (which could
    be why terminal is saying it's version 4.4.7)? Is there anyway to check for
    dormant versions of php or to switch over to running a different version?
    Well you could try this in terminal:
    <pre style="font-family: monospaced;">locate php</pre>
    It should show you nearly everything associated with php. As far as what the php version command lists this only picks up the CLI version of php not necessarily whats running on the web server. throw a php file in your webroot with the following code in it to see what the server is using:
    <pre style="font-family: monospaced;"><?php phpinfo(); ?></pre>
    That will give you the lowdown on what Apache is configured with. this is goign to depend on what mod_php is being used.
    Generally i wouldnt upgrade anything that lives in the system as you never know if it might get overwritten or updated when a system update comes down from apple. A better practice is to install the version you want to use to /usr/local/<dirname> so that the installations are isolated and manageable.
    If I don't have it, I need to install it. Is there an easy way of doing this via
    an installer? Is there anything I need to watch-out for whilst I'm attempting
    this feat?
    I generally use the php packages from www.entropy.ch just so i dont have to bother with compiling. My versions of Ruby, Apache 2.0.x and Apache 2.2.x i compiled myself, along with an upgraded version of Python and alot of other libraries.
    Then you can jsut make some changes to configuration files to use the versions you want. However if you use the entropy.ch packages of php as i suggested the installer takes care of the configuration changes for you. Jsut make sure you grab the one for the proper version of apache youre going to be using it with.
    Additionally you could always get Mac/DarwinPorts - whatever its called now... this is a package manager like apt-get or yum under linux. It fetaches the package for you from a repository, and installs it. I dont use these because they use a different dir structure than standard Darwin - ie. the create the /opt folder and install under this. I dont really like that so i dont use them - but that isnt going to cause you any problems, its jsut a preference thing.
    Also, does Leopard bring many advancements on the server front, i.e. Apache 2,
    php 5, MySQL etc, which might save me some hassle if I just go through the
    inevitable OS upgrade sooner rather than later?
    I know it comes with apache 2. I think it may also come with php 5.1.6 (5.2.x is avialable though).. not sure about MySQL at all...

  • 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.

  • Trying to run PHP, Mysql and Apache

    Hey guys, Basically Im at university and doing a web development project and i need to use mysql and php, and someone told me leopard already comes with it? Does anyone know how i can get it to work correctly? any steps from the beginning? - am new to macs
    Cheers
    Krups

    hello, I will suggest you to follow the instructions set up by Marc Lyianage in his website, the url is http://www.entropy.ch/software/macosx/ there you will find a page for setting up php5 (it comes preinstalled in leopard) and it has a also a package installer for mysql very easy to set up.

  • Installing php, mysql and apache

    Hey guys, Basically Im at university and doing a web development project and i need to use mysql and php, and someone told me leopard already comes with it? Does anyone know how i can get it to work correctly? any steps from the beginning? - am new to macs
    Cheers
    Krups

    This web page:
    http://www.macosxhints.com/article.php?story=20071030153912813
    claims to tell you how to do it, though after 12 hours of working on this today I seem to be no closer.

Maybe you are looking for

  • Ipod is not recognised by itunes or finder

    I have a 5th Gen iPod and currently using itunes 7.1.1 with the latest ipod software. When i plug my ipod in to my mac it doesn't show up in itunes or in the finder so will not sync and I cannot restore it. The ipod works fine to listen to music and

  • 8830 Stops checking email until a battery pull

    Hello:   I'm pretty new to BB's, the 8830 being my first one. My problem is that I have it set up to check a pop account but it seems that I need to pull the battery almost daily because it stops checking for new messages.  I've tried turning it off/

  • Search Webserver and only follow one specific hop

    Hello, we want to crawl our external website with sharepoint 2010 search. the files that are linked on the website are stored on another server. in order to crawl these files i have to set the content source to do one server hop. by doing this the co

  • Captivate 8: Slide Videos Repeat when Publishing in HTML5

    Conditions: Slide with MP4 h.264 video (no audio track) and separate audio track. Slide action on exit is to go to the next slide. Timeline is trimmed to .1 sec after end of video (Captivate doesn't allow it to be trimmed closer) Issue: Slide video w

  • Is the iTunes Store Online?

    For some reason none of the computers on my network can get to the iTunes store. The error message we all get is iTunes could not connect to the iTunes Store. When anybody runs the diagnostic application we get a Windows error bos that says iTunes ha