Please post comments and questions on the PHP Installation Tutorial here.
Printable View
Please post comments and questions on the PHP Installation Tutorial here.
Great tutorial!
Even though I mostly use my computer as a development machine only I do allow others (friends) to connect to it to checkout my webpages. Maybe you could add a little something about what a good configuration would be in my case? I don't think I'm the only one who likes to show off to my friends what I have done :p
Ignore step 2 of the "Securing Apache" section and you have yourself a web server open to the Internet.
It is advisable that you nail down your Apache configuration by doing the following:
- Set up a virtual server to handle all requests and put the DocumentRoot into another directory. Preferably on another drive.
- Allow only one directory where cgi programs can run.
- Make a backup of important data, just in case.
I wouldn't advise that you put any kind of public web site on a Windows server. When Apache is running as Administrator, exploits which allow control of the PC could result in serious problems, in my opinion, there is no way to run Apache securely on Windows as a public web server, which is why I left it out of the tutorial.
Thanks for the replay
* I have never looked in to virtual servers, so I don't know why it would be a good idea to have one. I will read up on that. I have already moved DocumentRoot to a move convenient place. It's pretty cumbersome to have it deep inside the apache folders... Unfortunately not on another drive since I only have one hdd with one partition in this computer
* I don't use cgi programs at all. How do I remove the possibility to use them at all?
* I allways try to keep a fairly fresh back up of my data. So much can go wrong with a computer that you experiment a lot with :p
The security reason is fair enough. Thanks for pointing it out
Hi visualAd,
This is so cool. I was never able to install Apache on my Windows XP and there were always some problems with Apache becuase i did'nt knew how to configure it. So i just used to use IIS.
But after readign your tutorial its so eassssssyyyyyyyyyyyyyyy.
Many Thanks. :afrog:
How about adding a section about installing phpMyAdmin?
I think that's the friendliest GUI to manage mysql databases with
I am somewhat busy at the moment and already have a couple of tutorials to finish. But, if you want to write one on instlalling PHP MyAdmin then please feel free, I'll put a link into the FAQ which should be going up within then next month. :)Quote:
Originally Posted by McCain
I'm buissy with other projects as well. So I don't have time unfortunatly.
Sorry
I didn't think there was anything to install... I thought all you need to do is unzip it and put in the folder that Apache/IIS uses? :ehh:
Hi,
Yes monavo is correct you just unzip the thing and if require do a bit in config.php and you're done.
Thank you.
It can get a bit messy when you have a password to mysql.
phpMyAdmin can't log in if you use the new password system mySQL uses. You have to tell mySQL to use the old system for phpMyAdmin to work, and that took atleast me an hour or so of searching the net to find out.
Hi, I followed the MySql steps exactly as described but I recieved a "security error"
http://img133.echo.cx/img133/7088/error7cb.jpg
so i closed that but the MySql program was still installed even though i could not click the "finish" button. When i try to log into the mysql database through the prompt command using the password i submitted to them i recieve an error denying me access.
So I take off the -p which is what is requiring the password and i gain access to the mysqlQuote:
C:\Documents and Settings\"username">mysql -h localhost -u root -W -p
Enter password: *********
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)
and i can create and delete the databases as the tutorial mentions, But when i get toQuote:
C:\Documents and Settings\"username">mysql -h localhost -u root -W
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18 to server version: 4.1.12-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
this is the error i recieve:Quote:
3. Connect to the new database
So i still try to bypass the password to test it, but i recieve this error:Quote:
C:\Documents and Settings\"username">mysql -h localhost -u php -D php_general -W -p
Enter password: *********
ERROR 1045 (28000): Access denied for user 'php'@'localhost' (using password: YE
S)
I'm using Windows Xp Home Sp1, any suggestons or ideas?Quote:
C:\Documents and Settings\"username">mysql -h localhost -u php -D php_general -W
ERROR 1045 (28000): Access denied for user 'php'@'localhost' (using password: NO
)
How odd, Dandono had the same problem, it appears that it had not set the root password. I wrote the installation tutorial and tested it on a Windows 2000 machine, this may be an issue/bug with configuration wizard on XP.
Back to solving the problem. Log on to the server as root:
And exectute this query to set your password:Code:mysql.exe -W -p -u root -h localhost -D mysql
Then you need to execute this query:Code:SET PASSWORD = PASSWORD('newpassword');
Exit the client, now you should be able to log on using the PHP user:Code:GRANT ALTER,CREATE,DELETE,
DROP,INDEX,SELECT,INSERT ON php_general.*
TO 'php'@'localhost' IDENTIFIED BY 'secret';
FLUSH PRIVILEGES;
Code:mysql.exe -W -p -u php -D php_general -h localhost
Hmm, im still having the same problem. Your first tip: "Back to solving the problem. Log on to the server as root: mysql.exe -W -p -u root -h localhost -D mysql" Wouldnt let me in because again you had it password protected with the "-p". So I entered that command without the -p and it allowed me access.
I followed your next step and everything went smooth. That appeared to fix it correctly. I can now log on to mysql with no problems at all...But I still cannot go on with the next step of your tutorial.
when I enter: " mysql -h localhost -u php -D php_general -W -p" I still recieve this error:
I know i'm typing the password in correctly and if you look the error message says im using the password...???Quote:
C:\Documents and Settings\"username">mysql -h localhost -u php -D php_general -W -p
Enter password: *********
ERROR 1045 (28000): Access denied for user 'php'@'localhost' (using password: YE
S)
Thanks VisualAd,
Wow.. thanks for putting in the time for that tutorial. Looks real nice. Im sure ill use it in the future. :wave:
Here is the full query again. You need to make sure you have selected the mysql database first:
Now try the following query:Code:USE mysql
GRANT ALTER,CREATE,DELETE,
DROP,INDEX,SELECT,INSERT ON php_general.*
TO 'php'@'localhost' IDENTIFIED BY 'secret';
FLUSH PRIVILEGES;
If it has worked you should see this:Code:SELECT user.user, user.host, db.Db FROM user,db WHERE
user.user=db.User AND user.host=db.Host;
Code:+-----------------+-----------+-------------+
| user | host | Db |
+-----------------+-----------+-------------+
| php | localhost | php_general |
Thanks VisualAd, I entered in that information and it did as you said it would. Though i am still a bit confused, It displayed the php/user table as you said it would if it worked but yet I still cannot use the "mysql -h localhost -u php -D php_general -W -p" command without getting that same error. Are they both the same thing? (that command and the second way you showed me, that displays the user/php table) It looks as if they are, but i wanted to make sure. :)
I am baffled :confused: - could you post the contents of your my.ini file in the mysql root installation directory?
Not a problem,
I hope you can figure it out. thanksQuote:
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server 4.1). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini"
#
# To install the server as a Windows service manually, execute this in a
# command line shell, e.g.
# mysqld --install MySQL41 --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQL41
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
pipe
socket=mysql
default-character-set=latin1
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]
skip-networking
enable-named-pipe
# The Pipe the MySQL Server will use
socket=mysql
#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 4.1/"
#Path to the database root
datadir="C:/Program Files/MySQL/MySQL Server 4.1/Data/"
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=latin1
# The default storage engine that will be used when create new tables when
default-storage-engine=MYISAM
# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=100
# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size=8M
# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=256
# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size=5M
# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before. This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size=8
#*** MyISAM Specific options
# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G
# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_max_extra_sort_file_size=100G
# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_sort_buffer_size=8M
# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size=8M
# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=185K
# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
sort_buffer_size=139K
#*** INNODB Specific options ***
# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
skip-innodb
# Additional memory pool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size=2M
# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1
# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size=1M
# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system. Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size=8M
# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size=10M
# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency=8
hi
this was a great tutorial, especially for a newbie like me (this is my first day dealing with databases).
now that my system (w2k) is all setup, i just want to be able to use a frontend program like mysql front or navicat.
but it seems like i cant make a connection on localhost with any of those programs. weird. their help file is useless.
any idea of what it could be coming from? a special setting in mysql, apache or something...
i m lost...totally lost
cheers
stef
Sorry for the late reply. I have had a good look around and still have no idea what is going on. The my.ini file seems fine too.Quote:
Originally Posted by Resilience
I found an entry in the MySql bugs database too, but I don't think its a bug: http://bugs.mysql.com/bug.php?id=6891
Here is a couple of suggestions:
- Create another database called php_general2 and go though the same steps of adding a user to this database, but call the user php2. Can you access the database with this user from the client?
- If the above didn't work. I recommend you remove all traces of mysql from your system and start over ensuring there are no previous installations.
I'm sorry i couldn't give you a proper answer, let me know how you get on though. ;)
Maybe you should say something about adding index.php to the DirectoryIndex line in httpd.conf file as well in the tutorial?
I had to add UPDATE to the following command from the tutorial. If I didn't I wasn't allowed to update the database...
Code:GRANT ALTER,CREATE,DELETE,
DROP,INDEX,SELECT,INSERT ON php_general.*
TO 'php'@'localhost' IDENTIFIED BY 'secret';
I just installed PHP 4.4.1 and MySQL 4.1 and Apache 1.3.34, and got two problems I have had before. So for future problems for me and anyone else that might want this weird mix here is a couple of QAs:
ErrorMessage: "mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client"
Solution:
Upgrade all client programs to use a 4.1.1 or newer client library.
OR
Update the password. Something like this should work while logged into MySQL as root:
http://dev.mysql.com/doc/refman/5.0/en/old-client.htmlCode:mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
Ehhh...I had one more problem, but I can't remember what it was now..:) Try to remember it in a while..:)
ohhh yeah..:) For PHP 4.* you should edit the httpd.conf file like this or something:
- ØØ -Quote:
LoadModule php4_module "C:\PHP\sapi\php4apache.dll"
AddModule mod_php4.c
AddType application/x-httpd-php .php4 .php3 .phtml .php
AddType application/x-httpd-php-source .phps
Quote:
Originally Posted by Resilience
I just had the same problem with my Laptop with Win2K. I logged in as root with no password and did as Visual said, and it worked for me.
Hey there folks, excellent tutorial! Nearly worked for me.. :p I just have a question about the test portion of the PHP installation.. When I attempt to use the test script you provided to see if there are connectivity issues with MySQL, I have one.. I try to access localhost/db.php, and it gives me this
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\db.php on line 7
Haven't the slightest idea what I could have done wrong. Any assistance would be greatly appreciated :)
Did you download php 5?
From memory, support for the mysql_* functions aren't automatically built into php5, you might need to compile it yourself or search the php site for a workaround. Otherwise, you could just use php 4.3.* and it should fix the problem!
You need to make sure you download the ZIP version of PHP 5, which contains the php_mysql.dll file. You then need to uncomment the line in the php.ini file:
Code:extension = php_mysql.dll
Yes, I do have 5.x.. and I was looking around the PHP site for the modules to download, can't find them though.. think for terms of easyness it would be best to just revert to 4.3?
Hmm, seem to be experiencing the same problem.. I downloaded the PHP zip file, and then extracted it, without overwriting the other files, so I could get the libraries needed and keep any configurations from the install... made sure the ini file is set for
extension = php_mysql.dll
but its still not working and I'm getting that error on line 7
any other possible reasons i can investigate?
Do you have the file php_mysql.dll?
Is it in the extensions directory?
Have you copied libmysql.dll from the MySql install directory to the Windows directory?
I haven't the slightest idea where I went wrong, still the same error.. I uninstalled/reinstalled everything and tried again, just to see if I fubar'd it somewhere.. no luck.. any other ideas?
Try 4.3* :p
What about these things?Quote:
Originally Posted by visualAd
You can also make a file with the function phpinfo(); and check the output. It will list the location of the php.ini file. Is the file listed here the one you are editing or is it one which does not exist?
I'm certain the output of the phpinfo function is correct, I've edited the ini to include the right files and the correct statements.. should I just reinstall again, and reattempt?.. or would you suggest I abandon it and go for something else.. I was using ASP/IIS for a brief while learning web progging but I like the idea of using PHP.. I suppose some inexplicable desire, seeing as I haven't even used it yet.. even when I was using ASP/IIS, it wouldn't be able to utilize all the functions including just filereading.. I'm lost
:eek:Code:do while me.lost=true
help(me)
loop
How are you certain? Did you create a file which called the phpinfo() function? Do the following, follow it step by step. I am getting the distinct feeling you are missing things out:
- Check that the extensions directory contains the file php_mysql.dll. Is it there? If not, downlaod php again, the ZIP download, search for the file and copy it to the extension directory.
- Open up the php.ini file and check that the extension_dir setting matches the extensioins folder you just checked. If not, change it.
- Find the root install directory of Apache. Usually C:\Program File\Apache Group\Apache 2.x.x\
Find the file libmysql.dll and copy it to the Windows directory, either C:\winnt or C:\windows.
- Restart your Apache server.
- Create a file called phpinfo.php containg one line:
PHP Code:<?php
phpinfo();
?>
- Open this page in the browser and check the following:
Configuration File (php.ini) Path - should be the path of the php.ini. If it is not it means that php is not finding it. Try moving the php.ini file to the location php thinks it is in.
extension_dir -this should be the path you [put in the php.ini file, it should also be the location of your php_mysql.dll file. If not, change it.
Finally check for a section entitled my MySql, if this doesn't exist them extension is not enabled.
If MySql insn't working, it will be for one of these reasons, so if you wnat to solve the problem go through each.
HADES OF THE NETWORK :mad:TOMCAT :cry:Quote:
"welcome to limbo-net, population you,"
*points at tomcat*
"..you'll be here awhile, unable to implement PHP into a page for a long long time, for, well.. reasons totally unknown, so relax sit back and suffer the eternity of ASP and IIS!"
yeop.. checked it.. twice.. still isn't working, and i haven't the slightest idea as to why, everything is the way it should be except that it doesn't work.. i'll reinstall and try again, but yea, any further input is well appreciatedQuote:
*gulp*
You are not giving any information on what is and isn't working. Look at my previous post, go through each step and tell us for each step the result. Yes, No, etc.
What does the phpinfo() show? Where exactly are your dll's? Is it using the correct php.ini file? Does a Mysql section show up in the phpinfo()? Also, do you get any errors when you start Apache or MySql?
sorry, all of the steps i went through are completed, i'm simply recieving the same error that i recieved before on line 7 of the test code you provided on the tutorial thread. phpinfo(); works, it shows me all the information you're telling me it should, yet it still doesnt recognize that mysql functions are existant. there unfortunately isn't much more to tell than that, as far as i know, mysql does show up in the phpinfo(); output
OK that means it is working :)