PHP and MySQL for Dynamic Web Sites by Larry Ullman

PHP and MySQL for Dynamic Web Sites by Larry Ullman

Author:Larry Ullman
Language: eng
Format: epub, pdf
Publisher: Peachpit Press
Published: 2018-11-13T05:00:00+00:00


* * *

To prepare the server:

1. Run the phpinfo() function to confirm your server settings .

A phpinfo() script returns all the information regarding your PHP setup, including all the file-upload handling stuff.

The phpinfo() function prints out a slew of information about your PHP setup. It’s one of the most important functions in PHP, if not the most (in my opinion). Search for the settings listed in Table 11.1 and confirm their values. Make sure that file_uploads has a value of On and that the limit for upload_max_filesize (2 MB, by default) and post_max_size (8 MB) won’t be a restriction for you. If you are running PHP on Windows, see whether upload_tmp_dir has a value. If it doesn’t, that might be a problem (you’ll know for certain after running the PHP script that handles the file upload). For non-Windows users, if this value says no value, that’s perfectly fine.

By the way, another advantage of using an all-in-one installer, such as XAMPP for Windows or MAMP for macOS, is that the installer should properly configure these settings, too.

2. If necessary, open php.ini in your text editor.

If there’s anything you saw in Step 1 that needs to be changed, or if something happens when you go to handle a file upload using PHP, you’ll need to edit the php.ini file. To find this file, see the Configuration File (php.ini) path value in the phpinfo() output. This indicates exactly where this file is on your computer (also see Appendix A for more).

If you are not allowed to edit your php.ini file (if, for instance, you’re using a hosted server), then presumably any necessary edits would have already been made to allow for file uploads. If not, you’ll need to request these changes from your hosting company (which may or may not agree to make them).

3. Search the php.ini file for the configuration to be changed and make any edits .



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.