PHP Diary
| Script School | PHP Scripts | TD Scripts.comThe Question
"I am a beginner to PHP and need some help. I'm reading on how to write my own PHP scripts but for now i need to know how to use someone's else's script for the time being. i know how to install CGI scripts but it is not that simple. I've even tried reading the instructions that come with the PHP scripts but i am still lost. Is there an easier way to do this..."
Installing a php script should be more friendly than installing a cgi-script, generally speaking, and it is due in part to the help the php parsing engine gives us. You will likely take the following steps:
1. edit the configuration variables inside the php script
(look for setup.php or config.php or something like this in the readme.txt).
2. You will need to set absolute paths most likely to directories if the script will be
doing any file writing. The absolute path is the full path from the server to the
directory you are writing to. Something like this (shown in red/green):
/home/usr/htdocs/datadir
The RELATIVE path is the path from public or html portion of the directory (shown in green above):
/datadir
3. If the script utilyzes a mySQL database then you will need to create the tables associated with the mySQL database. If the script doesn't come with a helper table creation script then you can use telnet. There is instructions on how to use telnet to create a mySQL table in one of my prior diary entries: click here for 7-07-00 diary
4. You will likely need to set UNIX permissions for any file/directory that the script must access. In doing so you should be given the permission settings in the readme file. If there is no readme then you might try the following:
chmod 666 filename.txt (any file that needs to be
read/written by the php script)
chmod 777 DIRECTORY (any directory that needs to be read/written by the php script)
5. If the script requires function froms php 4.0 and your version of php is less than 4+ then you will need to have your host compile php 4.0 on the server or rewrite the portions of the code calling those functions. You can check what version of PHP you are using by creating a simple test.php file with the following code:
<? phpinfo(); ?>
This will tell you a lot more than just what version of PHP
you are running. Try it :)
6. upload all scripts in ASCII mode. Binary can really mess up script source files, so
look into your FTP editor settings and ensure you are using ASCII mode for any scripts you
try to upload.
7. Does the script require the gd library or other modules which are not included
with the core php source? If the script does then these libraries must be compiled by your
host (or you) prior to executing the script. Check the script readme documentation for
more help on this.
I think this hits the high points in doing a php install. Fortunately the parser should help you by explaining the errors when you try to run the script.
Most script install errors are the fault of the wrong paths being assigned in the configuation. Learn what your paths are to the following directories by either contacting your host or reviewing other scripts installed on your server:
1. absolute path to your cgi-bin
2. absolute path to your www or public html directory
3. absolute path to your NON public directory. Some scripts require loading
password files and other secure files ABOVE the public directory for enhanced security
from the web.
Some scripts require you to use .htaccess to protect the admin areas. You can use telnet to create .htpasswd style files but if you don't have telnet access then I've created a little program that you can use for free to create an encrypted password file. You can find it at:
http://www.tdscripts.com/tidbits.shtml#.htaccess
// shows you how to build an htaccess file to protect a directory
http://www.tdscripts.com/tidbits.shtml#Generating
// helps you generate an encrypted password combination
Earthquake
On Wednesday Feb 28, 2001 our office got rocked by the 6.8 earthquake. It had power out for several hours at our office (a transformer blew). When power was restored we discovered a gas line had been ruptured which further delayed our operation. I remember the last earthquake we had, because I was in a suite at the Kingdome watching a Mariners game. Boy it was a scary thing seeing atheletes frantically tell their families to get out of the dome.
Please vote on the usefulness of this diary entry so other people will know if it is worth their time to read :)
[back]
03/03/01 "Installing
PHP Scripts"
[next]
PHP Diary | Script School | PHP Scripts | TD Scripts.com
Copyright 1999-2010 php-scripts Last Modified 04/27/01 01:16