Configure Apache on Leopard OS 10.5
One of the great advantages of developing web sites on a Mac is the fact that all of the tools you need to run a web server are pre-installed. Getting them to work and play well together requires a little work—especially in Leopard.
If you are simply wanting a web server to host your personal web site, then you might want to consider stand-alone, point and click apps like XAMPP and MAMP. These turnkey solutions set everything up for you and are great solutions if you are just starting or have simple needs.
However, if you want to set up a development environment running multiple test sites using the free tools already installed on your Mac, and you aren’t afraid of the terminal, then read on.
UPDATE: Since posting this tutorial, I have learned that the stock installation of PHP does not include several critical libraries. After several days of experimenting, I finally landed on MAMP as my production solution. I have published a walk-through for setting MAMP up on your machine [link].
NOTE: This guide is specific to getting a server running on Leopard 10.5. Earlier versions of the OS are not covered here.
This guide will walk you through the steps needed to get a development environment set up and running on your copy of Leopard. In this, we will do the following (click on each to jump to the corresponding section):
Enable your root password
Install the Xcode Tools
Edit your Apache configuration file
Set up your first virtual host
Start/Restart Apache
Test Apache
Test PHP
Load MySQL
Install phpMyAdmin
Install PEAR
Overview
A commonly used web server solution consists of 3 major components: Apache web server, a MySQL database, and the PHP scripting engine. This is the "AMP" in LAMP. (The "L" is "Linux"). This set up is widely used in the development community for two reasons: 1) it’s free and open source, 2) it’s very mature. "AMP" components are included in every copy of OS X, but getting them to work requires a few steps.
Step 1: Enable your root password
Open the Directory Utility: In the Finder, navigate to the Utilities folder (tip: click on the desktop, hit Cmd+Shift+U).
Click on the padlock to allow edits.
Go Edit > Enable Root Password
Enter and re-enter your password.
Now, you are set to access protected areas of the system via the terminal.
Step 2: Install the Xcode Tools
While this isn’t strictly necessary, it’s good practice for developers to install the Xcode tools provided for free on your Leopard disc. You’ll need it at some point, so go on and install it.
Insert your Leopard DVD
Navigate to Optional Installs > Xcode Tools > XcodeTools.mpkg
Run the installer.
Go get a cup of coffee.
Step 3: Edit your Apache configuration file
Note: throughout this guide, you will need to edit configuration files. There are several ways to do this. My preferred method is to use an app called BBEdit that allows you to edit protected files more gracefully than, say, TextEdit or the terminal window. However, BBEdit is not free. For the purposes of this tutorial, I’m going to stick with the terminal method that uses the editor called "nano" just because it’s included on every system.
In the terminal, type:
sudo nano /private/etc/apache2/httpd.conf
Note: "sudo" is a command that lets you perform a specific task with root privileges without having to log in as the root. This is the recommended method of mucking about in the terminal as it is safer than being logged in as root.
Scroll down to about line #114. You’ll see the following:
#LoadModule php5_module libexec/apache2/libphp5.so
Remove the hash mark as follows:
LoadModule php5_module libexec/apache2/libphp5.so
In order to run multiple sites on this server, you will want to use virtual hosts. Scroll down to the bottom of the document (about line #461) and remove the hash from the Virtual Hosts entry as follows:
Include /private/etc/apache2/extra/httpd-vhosts.conf
Exit and save httpd.conf.
Step 4: Set up your first virtual host
Virtual hosts are Apache’s way of letting you serve up multiple sites on a single server. Name-based virtual hosting is a convenient way to do this.
For this example, we’re going to set up a test site called "site1". With a name-based virtual host, all we’d type in is "http://site1/ ".
In order to make this work, we’ll need to edit the hosts file on your machine. (Note: In Tiger and previous versions of OS X, you accomplished this through the NetInfo dialog. Since the NetInfo dialog was killed in Leopard, we do this the same way you do this for *nix and Windows by editing the hosts file directly).
To edit your hosts file, type in the terminal:
sudo nano /etc/hosts
Below the default entries, you’ll add the following:
# My sites
127.0.0.1 site1
Save your changes.
Now, we’ll need to add a corresponding virtual host. But first, Apache wants us to add our existing default directory as the very first virtual host. This is critical, so do not skip this step.
To edit your virtual hosts file, type in the terminal:
sudo nano /etc/apache2/extra/httpd-vhosts.conf
Replace the two example virtual hosts with the following:
<VirtualHost *>
DocumentRoot "/Library/WebServer/Documents"
ServerName localhost
</VirtualHost>
Next, add your first virtual host similar to the following:
<VirtualHost *>
ServerName site1
DocumentRoot /path/to/site1
</VirtualHost>
Who do we have to add our default directory first? According to the Apache Docs on Virtual Hosts, they recommend the following:
If you are adding virtual hosts to an existing web server, you must also create a <VirtualHost> block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host.
Note: Failing to add my default directory as the very first virtual host tripped me up for days. If your virtual hosts are defaulting to an unexpected directory, this is likely to be the culprit.
Step 5: Start/Restart Apache
If you haven’t done so already, go Apple Menu > System Preferences > Sharing
Ensure that “Web Sharing” is checked
Tip: To restart Apache in the future, you can come to the same control panel, uncheck and recheck the Web Sharing item.
Tip: Alternatively, you can type the following into a terminal:
sudo /usr/sbin/apachectl graceful
Tip: Alternatively, you can create an Automator script as follows:
Open a new, blank, custom workflow
Add a “Run AppleScript” action.
Type the following, replacing values as necessary:
do shell script “sudo /usr/sbin/apachectl graceful” password “[YOUR ROOT PASSWORD]” with administrator privileges
Save the workflow as an Action.
Step 6: Test Apache
In a browser, load your localhost: http://localhost
If you see the default Apache home page (which contains a red and blue feather image), your Apache server is set up correctly. If you do not, then you might try checking your Apache config syntax:
sudo apachectl -t
Step 7: Test PHP
In your favorite code editor, create a new php file and call it "info.php". In this file, enter the following code:
<?php phpinfo(); ?>
Save the file to the root of your local host directory (e.g. "/Library/WebServer/Documents/info.php") directory. In your browser, navigate to the file (e.g. "http://localhost/info.php").
You should see a purple and white table containing all the PHP variables, modules, and settings. If you don’t see this table, backtrack to Step 3 above to ensure you’ve enabled PHP in your Apache config file correctly.
Step 8: Load MySQL
Download and unzip the MySQL Package for Mac OS X.
Install the main MySQL installer.
Install the Start Up Script.
As of this writing, MySQL has not been updated to support Leopard. You will be downloading the package for Tiger (10.4) and making the following modifications:
Do NOT install the MySQL control panel. As of this writing, it does not work with Leopard.
Start MySQL manually by typing the following into a terminal:
sudo /usr/local/mysql/support-files/mysql.server start
MySQL should now be running silently in the background.
A new issue with Leopard’s installation of PHP is that it expects MySQL to be somewhere other than where it is installed by the package. To fix this, we need to create a new MySQL configuration file. To do this, create a text file and save it as "/etc/my.cnf". Enter the following text:
[client]
socket = /var/mysql/mysql.sock
[mysqld]
socket = /var/mysql/mysql.sock
In a terminal window, type the following in order to create a folder where the MySQL sock file will live:
sudo mkdir /var/mysql
sudo chown _mysql /var/mysql
Note: If you are using any of the MySQL Tools (e.g. MySQL Administrator, etc.), you’ll need to tell them where to find the sock file. To do this, click the Advanced drop-down on the connection dialog, and enter “/var/mysql/mysql.sock“.
At this point, you should have a fully functioning database. Now, let’s get some data in there.
Step 9: Install phpMyAdmin
phpMyAdmin (PMA) is a popular and free tool to manage your MySQL databases. It is an integral part of most LAMP development environments.
Download and unzip the latest stable release of phpMyAdmin.
Copy the files to a directory of your choice. For this example, we’ll install it in "~/Sites/phpmyadmin/".
Per Step #4 above, add this directory as a virtual host called "pma".
Restart Apache to initialize your new virtual host.
Follow the installation instructions provided in the PMA download to set up the config file.
If you can navigate to PMA (e.g. "http://pma", you’ve good to go.
Step 10: Install PEAR
PEAR is a companion to PHP that is typically installed by default along with PHP. PEAR is a set of applications, modules and pre-packaged classes that provide a wealth of functionality to your apps with minimal effort. One example covered on this blog is how to implement an elegant caching mechanism with just a few lines of code. Using PEAR is highly recommended.
In a terminal window, type the following:
curl http://pear.php.net/go-pear > go-pear.php
sudo php -q go-pear.php
This will auto-install and pre-configure PEAR for you.
Now, we need to tell PHP to look for the PEAR files. To do this, we’ll need to modify the php.ini config file. First, copy the default config file and rename it php.ini by typing the following in a terminal window:
sudo cp /etc/php.ini.default /etc/php.ini
Now, edit the php.ini file:
sudo nano /etc/php.ini
Scroll down to line #469 or so and edit the include_path variable by removing the comment hash and adding the PEAR path as follows:
include_path = ".:/php/includes:/usr/lib/php:/usr/share/pear"
Restart Apache and ensure everything loads and runs as expected.
Conclusion
By this point, you should have a fully functional development server that you can extend and expand as you take on new projects.
Please feel free to add comments below if you find errors or problems with the guide above.
Good luck.
Sphere: Related Content
Tags: 10.5, apache, development server, lamp, leopard, mysql, os x, pear, php
This entry was posted on Monday, November 5th, 2007 at 5:31 pm and is filed under Tips & Tricks, Tutorials . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
30 Responses to “Setting up a Web Server on Leopard (OS X 10.5) Running PHP, Apache, and MySQL - A Step by Step Guide”
krisziel Says:
November 17th, 2007 at 9:53 pm
Hey,
this is a great wlakthrough, thanks for it. I have encountered an error when trying to access the server though. I get the message that I am forbidden from accessing the page. I am administrator on my computer, and don’t know how tog et around this problem
sstringer Says:
November 23rd, 2007 at 7:04 am
This problem happens when you’ve turned off the indexes option in your Directory settings but don’t have a default file that Apache can open.
To fix this, open your httpd.conf file and search for “DirectoryIndex”. Let’s say your site uses “index.php” for it’s default homepage. You’ll want to add that to the DirectoryIndex line which already includes names like “index.htm”. Add yours, save, and restart Apache. You should now get your site to come up without the “You do not have permission…” error.
-Steve
andrea74 Says:
November 29th, 2007 at 4:45 am
Hi, thank you for the manual.
I have a problem: I added a new irtual host following the instructions at Step4 (for example site1): if I save a file called info.php in the directory, I can open it by browser with http://site1/info.php, but all the others file inside the directory can’t opened (for example, I copy info.php and renamed it to info2.php: if I try to open http://site1/info2.php, the browser give me the error message
Not Found
The requested URL /info2.php was not found on this server.
Any idea to solve this problerm?
Thank you in advance.
Andrea
sstringer Says:
November 29th, 2007 at 6:35 am
@andrea74:
This one’s new for me. I’m a little baffled, in fact.
The only thing I can think of is that your site1 is not the site you think it is. Let me explain.
When you set up a virtual host but haven’t set a default host, Apache will use the first virtual host it finds and serve it up regardless of the url you enter into your browser.
If you’ve set up, say, a test version of site1 in Apache’s default folder and then later tried to point your host to a different folder for site1, *but* you didn’t define the default virtual host correctly, then any changes you made in site1 wouldn’t show up in your browser and would, in fact, cause the error you’re seeing.
To test this, make an obvious text change to info.php. If the change shows up when you enter http://site1/info.php, then I’m wrong. If I’m right, though, the change wouldn’t show up.
To fix this, find the "DocumentRoot" directive somewhere around line 368. Make note of that path. Mine’s "/Library/WebServer/Documents"
Now, in your virtual hosts, define that folder as the very first virtual host:
#
# Use name-based virtual hosting.
#
NameVirtualHost *
#
# Default virtual host
#
<VirtualHost *>
DocumentRoot "/Library/WebServer/Documents"
ServerName localhost
</VirtualHost>
Give it a shot and let me know if it works.
-Steve
andrea74 Says:
November 29th, 2007 at 8:56 am
Dear Steve,
everything is OK now: thank you very very much for your help.
All the best!
Andrea
sstringer Says:
November 29th, 2007 at 9:51 am
Glad it worked for you. Did I guess the problem correctly, or was it something else?
rwhart Says:
December 1st, 2007 at 12:50 pm
I have done all the above, and still have no proof that php5 was installed. I am a little baffled at the way Apple has played with the directory tree( I am mainly a Fedora user). I do not know of any way (obviously I am new to the Mac platform) to check to see if a program is installed - e.g. on Linux I can do a ‘rpm -ql | grep [filename]’ and see if the package is installed.
Is such a tool on Leopard?
Thanks,
Bob
incoe Says:
December 10th, 2007 at 5:20 am
thanks alot for setting up steps, it helped alot, however i tried running mysql manually as you wrote and it gave me this message:
Starting MySQL
………………………………………………………………………………………/usr/local/mysql/support-files/mysql.server: line 159: kill: (52984) - No such process
ERROR!
also i possible to help in this issue too, i typed apchectl -k stop was testing it, and then tried starting it but it keep giving this
apachectl -k start
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
any suggestions?
Thanks.
Karim.
sstringer Says:
December 10th, 2007 at 8:45 am
@incoe:
Sounds like a permissions problem across the board. When you launch either apache or MySQL manually, be sure to do so with the “sudo” directive before the launch command so the process will have sufficient permissions to launch itself.
incoe Says:
December 10th, 2007 at 10:03 am
thanks for helping, the apache is working fine now, but the problem with mysql keep persisting i tried installing it again but no use it keep giving same message when i try starting it
Starting MySQL
………………………………………………………………………………………/usr/local/mysql/support-files/mysql.server: line 159: kill: (189) - No such process
ERROR!
also when i try the sudo mysql_secure_installation to set a root password it keeps giving another error
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
tried all blogs and forums, tries all solutions there but i cant figure out whats wrong, am new to these stuff so i can put my hands on the error it self
sstringer Says:
December 11th, 2007 at 4:35 am
Okay, you’ll need to create an alias to the main sock file. In a terminal type:
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
(Assumes your MAMP installation is in the default location).
Dick Haight Says:
December 11th, 2007 at 8:52 am
I have had several Macs running as servers with PHP (osx 10.3, 10.4, G4s, G5s, Intels). I had recently converted to PHP 5.2+ with minor glitchs. So I wasn’t expecting much trouble going to 10.5. Since then I have had several days of frustration. I followed stringfoo’s steps 1 - 7 without success. Where before I was getting a “Forbidden” message when trying to access a localhost page now I get an “Unable to connect” message.
Any thoughts?
sstringer Says:
December 11th, 2007 at 10:59 am
@Dick Haight
“Unable to connect” typically means Apache isn’t running at all. Too many reasons to count as to why this might be, but typically it’s a typo or misconfiguration in your Apache config (httpd.conf) file. Try typing the following into a terminal:
sudo apachectl configtest
“Forbidden” is typically caused when you have a non-standard (from Apache’s point of view) default page and have indices turned off. See comment #2 above for the fix to that.
jedmtnman Says:
December 12th, 2007 at 4:39 am
Great tutorial so far, let me just check that I have a couple things correct…
In my virtualhosts file, i have it set up like this:
DocumentRoot “/Library/WebServer/Documents”
ServerName localhost
ServerName site1
DocumentRoot /Sites/site1
ServerName “pma”
DocumentRoot ~/Sites/phpmyadmin
I just wanted to check that the path does not need to be in quotes, like the default host and that site1 doesn’t need the ~/
Reson I ask is that I cant seem to navigate to the phpmyadmin site if saved in my Sites folder(access forbidden), but if i store it in the Library/WebServer/Documents directory and I navigate with a browser to http://localhost/phpmyadmin I at least get an error that my config file is messed up.
Also, if i go to the web sharing CP and click on the link to my ip/~user, it says access forbidden. This worked before my Leopard upgrade. Any ideas?
You have done a fantastic job on this tutorial and a lot of testing/research. It is very much appreciated.
thanks,
Jed
sstringer Says:
December 12th, 2007 at 4:53 am
@jedmtnman
Quotes are necessary if you have a space somewhere in the path name, but it’s always a good practice. But that’s not the problem here…
Your problem is that you’re using tilde (~) in your paths. Since Apache is actually a different, privileged user on your system, it’s tilde shortcut is different than yours, so ~/Sites/phpmyadmin isn’t what you think it is.
Use your full path and see if that works. e.g. /Users/[YOU]/Sites/phpmyadmin
Tip: Drag your target folder into a leopard terminal or textedit window, and the full path will be typed out for you.
lebafar Says:
December 20th, 2007 at 12:12 am
Hey, I don’t want to sound repetitive but I think I am having the same problem of those guys above me were. Well, for every of the three different ServerNames I type on my browser I only access the contents of the localhost DocumentRoot path.
My httpd-vhost.conf file is set like that :
DocumentRoot “/Library/WebServer/Documents”
ServerName localhost
ServerName site1
DocumentRoot “/Users/lebafar/Sites”
ServerName pma
DocumentRoot “/Users/lebafar/Sites/phpmyadmin”
Am I doing something wrong?
Thank you for the site and you help !
Lebafar
sstringer Says:
December 20th, 2007 at 3:40 am
@lebafar
It’s hard to say, exactly, what might be wrong. Assuming your first entry immediately follows the “NameVirtualHost *” line, it should work.
You did uncomment the vhosts link, right? That’s the only other thing I can think of.
lebafar Says:
December 20th, 2007 at 7:19 am
yes, I did. You mean the step 3.3, right?
lebafar Says:
December 20th, 2007 at 7:27 am
How do I access this vhosts? I thing here I might be having a issue. Like, from my own computer I would type http://site1 and it would open “/Users/lebafar/Sites”. But how about if I am from outside my network?
sstringer Says:
December 20th, 2007 at 8:12 am
@lebafar
Yes, 3.3.
If you’re outside your network, there are some extra steps you’ll need to take that are outside the scope of this tutorial. Generally, though, you’ll need to add an alias to each virtual host. Same syntax as “ServerName” but use “ServerAlias” instead. If you’re on an intranet, you can type the ip of your machine directly. If you need to access the server from outside your home network, assuming you have a static IP (or an account on DynDNS), you’ll set up a port forward on your router to the server in question and then type the alias after your IP or URL (e.g. http://lebarfar.com/pma/). Note that this has the significant drawback of altering your URL structure which affects site-relative linking. The other way to do this is to get a url for each test server, point it at your router, set up port-forwarding as before, and set up a virtual host for unique url.
lebafar Says:
December 21st, 2007 at 10:16 am
Oh well, I think I solved my broblem now. It was a cache thing. Thank you very much for your attention and for this great job you did Steve!
jsahiri Says:
January 14th, 2008 at 1:51 pm
Hi sstringer,
This is one of the best step by step instruction I have ever seen. One comment and then a couple of questions:
1) Created the file info.php as indicated in step 7 and it would not work. Then I remembered that there was phpinfo inside the ext body, saved the file as phpinfo.php instead and it worked.
2) As reported by another guest, I had a problem with virtual host. Have no problem seeing apache when I launch http://localhost. But when I try to use http://sites1 or http://pma, I get “Safari can’t open the page “http://pma/” because it could not connect to the server “pma”.
Wonder what I am doing wrong. I have sites1 and pma under My Sites in the hosts file as indicated in the step 4. But in the virtual hosts, I have the documentroot path pointing to nowhere in fact since I didn’t create a file called sites1 to insert in Sites. Same with pma. Could this be the problem. If I had to create a file called sites1 to put in Sites and pma to put in phpmyadmin, what should it contain?
3) When creating automator script to run “to launch apache and mysql” where should they be saved? Anywhere? I am new to Mac and have not played around with automator yet.
sstringer Says:
January 14th, 2008 at 5:55 pm
@ jsahiri
re: 2) if safari, or presumably any browser or ping utility, can’t see “http://pma”, it’s likely due to a missing value in your hosts file, but it sounds like you thought of that. Double-check your formatting (Leopard is picky about some values needing to be at the top), and ensure that that’s not the problem. If you’re unable to load *any* local domain, then the problem is likely due to Apache not running. This could be due to a typo in the config file, for instance. Try starting and stopping apache in the command line to see if it loads correctly. Also use the apache config file syntax checker to ensure your config file is correct.
re: 3) The location of your Automator file shouldn’t matter as long as you are using the full paths in your scripts. Remember that these need to run as a privileged user (root, typically) and, thus, the tilde shortcut (~/Sites/) won’t work.
jsahiri Says:
January 14th, 2008 at 7:01 pm
Steve,
Thanks for your quick reply. http://localhost works. What does not work are the virtual domains (sites1 and pma). Here are the contents of
1) the hosts file
#
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
# My sites
127.0.0.1 localhost
127.0.0.1 site1
127.0.0.1 pma
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
and
httpd-vhosts.conf file
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn’t need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
#
# for further details before you try to setup virtual hosts.
#
# You may use the command line option ‘-S’ to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any block.
#
DocumentRoot “/Library/WebServer/Documents”
ServerName localhost
ServerName site1
DocumentRoot /Sites/site1
ServerName pma
DocumentRoot /Users/nameofadminuser/Sites/phpmyadmin
sstringer Says:
January 15th, 2008 at 8:50 am
@ jsahiri
Your vhosts file looks right. Assuming these other sites don’t load at all, the only other thing I can think of are that you forgot to uncomment your link to your external vhosts file. One other thing to try is to drop the port 80 designation from your vhosts. Anywhere it says “:80″, delete it. It’s grasping at straws, but it’s all I can think of.
jsahiri Says:
January 15th, 2008 at 9:33 am
Steve,
1) In which file do I have to uncomment the link to the external vhosts file. I didn’t see this mentionned in the steps above. Can you be more specific?
2) does the deletion of port 80 apply to vhosts file only or to some other files. If the latter, do you know which ones: httpd.config, php.ini?
Thanks
sstringer Says:
January 15th, 2008 at 6:19 pm
@jsahiri
1) Reference step 3.3 above
2) vhosts only.
qaz Says:
January 15th, 2008 at 10:39 pm
On apache /leopard mac, when I try using the move_uploaded_file function I get this double error msg:
Warning: move_uploaded_file(upload/cat-1.gif) [function.move-uploaded-file]: failed to open stream: Permission denied in /Library/WebServer/Documents/WebWeb/upload_file.php on line 35
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/private/var/tmp/php3R28FM’ to ‘upload/cat-1.gif’ in /Library/WebServer/Documents/WebWeb/upload_file.php on line 35
Stored in: upload/cat-1.gif
but when I look, it isn’t in upload/cat-1.gif at all.
Tried playin around with php.ini and httpd.conf, but which httpd.conf etc eh?
help
sstringer Says:
January 16th, 2008 at 6:03 am
@qaz
This sounds like a permissions error. You’ll want to check the permissions on the destination folder (”upload”, and “/Library/WebServer/Documents/WebWeb/” in your example).
qaz Says:
January 16th, 2008 at 10:08 am
Cheers sstringer, ’twas permissions of course: I opened Terminal, gave the uploads directory ’sudo chmod 777′, and the file uploaded ok.
..Or at least it appeared to upload: the next problem was that the uploaded file was found to be empty or corrupted. To solve this I changed the “move_uploaded_file()” function to the “copy()” function, and for good measure passed its parameters (the filenames) as string variables,
ie. replaced
move_uploaded_file($_FILES[”file”][”tmp_name”],”upload/” . $_FILES[”file”][”name”]);
with
$tmpname=$_FILES[”file”][”tmp_name”];
$fullname=$_FILES[”file”][”name”];
copy($tmpname,”upload/” . $fullname);
$tmpname=”upload/” . $fullname;
I gather this has something to do with the browser not flushing its buffers as often as we might like, and copy(), a more definite command, gets around this problem.