|
-
Jul 12th, 2005, 05:16 AM
#1
Thread Starter
New Member
Installing PHP, Apache,Mysql
Hey there,
Ive got PHP & Mysql for Dummies (the Book). I want to learn Php and Mysql Databse. I started on the book, in the book is says you need to run a local webserver (it recommend apache) with mysql and php. So i started searching the internet and found this tutorial http://www.webmasterstop.com/48.html.
Iin the tutorial i got up to finishing installing php. I then tried the test my web server to see if the php was working by making the page it tells you to then I went into the file on my browser using the link http://localhost/phpinfo.php. It only showed the "<?PHP phpinfo(); ?>" as html it didn't profomre the php. I don't think my php it working with my apache . The only thing i did different to the tutororial was use different versions of Apache, php and mysql as i couldn't find the old php and mysql. What do i need to do?
Cheers
ACDC
Are the best band ever!
-
Jul 12th, 2005, 07:18 AM
#2
Re: Installing PHP, Apache,Mysql
I seem to remember helping you get this working on MSN and you did have it working. What happened? 
You need to ensure the httpd.conf file has the appropriate directives to handle PHP files.
-
Jul 12th, 2005, 03:05 PM
#3
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
Next day i tyred to use the local server again and it didn't work, what are the directives?
ACDC
Are the best band ever!
-
Jul 12th, 2005, 08:21 PM
#4
Re: Installing PHP, Apache,Mysql
try redoing the installation all over again. 
or maybe environment variables were somehow erased or something. 
what versions were you testing?
version 4 has a slight difference but it should be not so problematic I think.. ehehehe.
-
Jul 13th, 2005, 03:37 AM
#5
Re: Installing PHP, Apache,Mysql
You need to check the httpd.conf file, that has the directives in it for the PHP module:
Code:
### PHP Configuration
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
-
Jul 13th, 2005, 05:38 AM
#6
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
I added that to bottom of httpd.conf file, bit when i tryed to run the server it
had error saying there was no such file as php5apache2.dll in the php directory. I then went to the php direcotry and there was no such file.
Another idea would it be eaiser to run my local web server on linux. Ive read somewhere that linux comes pre installed with apache and probably mysql and php so do you think i should try linux. The PHP & MYSQL for dummies teaches in both linux and windows. I can do a dual boot so i still have windows for everything else and when i want to learn some php i can use linux.
ACDC
Are the best band ever!
-
Jul 13th, 2005, 09:16 PM
#7
Re: Installing PHP, Apache,Mysql
what version are you working on? php4? because the dll's for 4 is not on on php folder you have to move them.. and the file is not nameD php5apache2.. but php4apache2.dll.
-
Jul 13th, 2005, 10:50 PM
#8
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
Ok.
I got a new computer and ive started fresh i followed the tutorail at http://www.vbforums.com/showthread.php?t=330825 with the versions of mysql,apache & php visuladd told me to use, he told me overmsn. They are :-
apache_2.0.54-win32-x86-no_ssl
mysql-4.1.12a-win32.zip
php-5.0.4-Win32.zip
I followed the tutorail all the way to the end were it says
Configuring Apache
1. You now need to edit the httpd.conf configuration file. Re-open the file as detailed in step 1 of the “Securing Apache” section.
2. Add the following lines to the end of your http.conf file:
Code:
### PHP Configuration
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
3. To complete the setup restart the Apache server as detailed in step 3 of the “Securing Apache” section
I got up to step three then i tyred to retsart the server when i tryed and restarting the Apache server the error came up "PHP Startup: Unable to load dynamic library 'c:\PHP\ext\php_mysql.dll t' - The specified module caould not be found."
What do i have to do?
ACDC
Are the best band ever!
-
Jul 14th, 2005, 01:13 AM
#9
Re: Installing PHP, Apache,Mysql
could it be because of the extra t? at the end there?
Sorry, I myself followed the tutorial worked fine unless I start with setting up the mbstring and the psql dlls...
-
Jul 14th, 2005, 07:10 PM
#10
Re: Installing PHP, Apache,Mysql
I had trouble originally installing PHP, Apache, Mysql on my pc but found this tutorial and now I'm up and running. HTH 
http://www.sitepoint.com/article/php...1-installation
-
Jul 14th, 2005, 07:26 PM
#11
Re: Installing PHP, Apache,Mysql
Oh good. , Now mark this thread resolved.
-
Jul 14th, 2005, 09:58 PM
#12
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
Can someone just please tell me how to fix that error i get cheers!
ACDC
Are the best band ever!
-
Jul 15th, 2005, 08:09 AM
#13
Re: Installing PHP, Apache,Mysql
- Cehck the file php_mysql.dll exists in the c:\php\ext directory.
- Copy the file libmysql.dll to the directory C:\windows
- Ensure the extension_dir directivei nthe php.ini file is pointing to C:\php\ext
- Ensure the line extension=php_mysql.dll is uncommented in the php.ini file.
-
Jul 15th, 2005, 09:05 PM
#14
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
Ok all that i had wrong was i had "extension=php_msql.dll" uncommented instead of "extension=php_mysql.dll".
I changed it and then restarted my server no errors came up. YES!!
so i continued my PHP & MYSQL for dummies book and followed what is said it said:-
2. Create the following file somewhere in your Web space with the name
test.php.
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo “This is a PHP line”;
phpinfo();
?>
</body></html>
test.php
The file must be saved in your Web space for the Web server to find it.
3. Point your browser at the file created in Step 1. That is,
type the name of your Web server (www.myfinecompany.com) into the
browser address window.
If your Web server, PHP, and the test.php file are on the same computer
that you’re testing from, you can type localhost/test.php.
In order for the file to be processed by PHP, you need to access the file
through the Web server — not by choosing File➪Open from your Web
browser menu.
You should see the following in the Web browser:
This is an HTML line
This is a PHP line
Below these lines, you should see a large table, which shows all the
information associated with PHP on your system. It shows PHP information,
path and filenames, variable values, and the status of various
options. The table is produced by the line phpinfo() in the test script.
Anytime that you have a question about the settings for PHP, you can
use the statement phpinfo() to display this table and check a setting.
4. Check the PHP values for the values that you need.
For instance, you need MySQL support enabled. Looking through the
listing, find the section for MySQL and make sure that MySQL support
is On.
5. Change values if necessary.
If you don’t have administrative access to PHP, you have to ask the
administrator to change any values that need changing. If you installed
PHP yourself and/or have administrative access to PHP, you can change
the values yourself. (Changing PHP settings is discussed in Appendix B.)
I opend "test.php" through my browser and it said
"Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\Program Files\Apache Group\Apache2\htdocs\test.php on line 9"
ACDC
Are the best band ever!
-
Jul 15th, 2005, 09:19 PM
#15
Re: Installing PHP, Apache,Mysql
Change your double quotations from
PHP Code:
echo “This is a PHP line”;
to
PHP Code:
echo "This is a PHP line";
-
Jul 16th, 2005, 06:08 AM
#16
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
Cheers mate working sweet any more probs ill post
ACDC
Are the best band ever!
-
Jul 16th, 2005, 06:31 AM
#17
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
Need help again!
Next part of the tutorail im having problems in the tutorail it says:-
Testing MySQL
After you know that PHP is running okay, you can test whether you can
access MySQL by using PHP. Just follow these steps:
1. Create the following file somewhere in your Web space with the name
mysql_up.php.
You can download the file from my Web site at janet.valade.com.
<html>
<head><title>Test MySQL</title></head>
<body>
<!-- mysql_up.php -->
<?php
$host=”hostname”;
$user=”mysqlaccount”;
$password=”mysqlpassword”;
mysql_connect($host,$user,$password);
$sql=”show status”;
$result = mysql_query($sql);
if ($result == 0)
echo “<b>Error “ . mysql_errno() . “: “
. mysql_error() . “</b>”;
else
{
?>
<!-- Table that displays the results -->
<table border=”1”>
<tr><td><b>Variable_name</b></td><td><b>Value</b>
</td></tr>
<?php
for ($i = 0; $i < mysql_num_rows($result); $i++) {
echo “<TR>”;
$row_array = mysql_fetch_row($result);
for ($j = 0; $j < mysql_num_fields($result); $j++)
{
echo “<TD>” . $row_array[$j] . “</td>”;
}
echo “</tr>”;
}
?>
</table>
<?php } ?>
</body></html>
2. Lines 6, 7, and 8 of the program need to be changed. These lines are
$host=”host”;
$user=”mysqlaccount”;
$password=”mysqlpassword”;
Change host to the name of the computer where MySQL is installed —
for example, databasehost.mycompany.com. If the MySQL database is
on the same computer as your Web site, you can use localhost as the
hostname.
Change mysqlaccountname and mysqlpassword to the appropriate
values. (I discuss MySQL accounts and passwords in Chapter 5.) If your
MySQL account doesn’t require a password, type nothing between the
quotes, as follows:
$password=””;
3. Point your browser at mysql_up.php.
You should see a table with a long list of variable names and values. You
don’t want to see an error message or a warning message. Don’t worry
about the contents of the table. It’s only important that the table is displayed
so that you know your connection to MySQL is working correctly.
If no error or warning messages are displayed, MySQL is working fine. If
you see an error or a warning message, you need to fix the problem
that’s causing the message.
Error and warning messages are usually fairly clear. The following is a
common error message.
MySQL Connection Failed: Access denied for user:
‘user73@localhost’ (Using password: YES)
This message means that MySQL did not accept your MySQL account number
or your MySQL password. Notice that the message reads YES for Using
password but doesn’t show the actual password that you tried for security
reasons. If you tried with a blank password, the message would read NO.
If you receive an error message, double-check your account number and
password. Remember that this is your MySQL account number — not your
account number to log on to the computer. If you can’t connect with the
account number and password that you have, you might need to contact the
IT department or the Web hosting company that gave you the account
number. (For a further discussion of MySQL accounts and passwords, see
Chapter 5.)
I Change $host=”password”; so it's got my password and $host=”host”; so it's got my host name in it (localhost), and Save. I don't change $user=”mysqlaccount”; as i have no user name for mysql i know about. I open this file through my browser and get the error.
Parse error: syntax error, unexpected T_STRING in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 10
ACDC
Are the best band ever!
-
Jul 16th, 2005, 06:47 PM
#18
Re: Installing PHP, Apache,Mysql
Again it's the double quotations that you're using.
What are you using to generate your double quotations? Are you using Shift and then the key to the left of your Enter key? (contains ' and ")
-
Jul 16th, 2005, 07:46 PM
#19
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
I changed them all after posting that reply of mine now i get all this:-
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10061) in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 9
Warning: mysql_query() [function.mysql-query]: Can't connect to MySQL server on 'localhost' (10061) in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 11
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 11
Error 2003: Can't connect to MySQL server on 'localhost' (10061)
ACDC
Are the best band ever!
-
Jul 16th, 2005, 08:53 PM
#20
Re: Installing PHP, Apache,Mysql
The message means your mysql server is not running.
Goto C:\mysql\bin (or where ever you installed mysql on your machine) and double click on the file winmysqladmin.exe. This will start your server.
To have the server start each time to load Windows follow the steps below. (they were from the tutorial I linked to )
To ensure that the server is started whenever Windows starts, you might want to create a shortcut to the program and put it in your Startup folder. This is just like creating a shortcut to any other program on your system.
On WinNT/2000/XP/2003, you must install MySQL as a system service. Fortunately, this is very easy to do. Simply open a Command Prompt (under Accessories in the Start Menu) and run your chosen server program with the --install option:
C:\mysql\bin>mysqld-nt --install
Service successfully installed.
This will install MySQL as a service that will be started the next time you reboot Windows. To start MySQL manually without having to reboot, just type this command (which can be run from any directory):
C:\>net start mysql
The MySQL service is starting.
The MySQL service was started successfully.
Last edited by lintz; Jul 16th, 2005 at 08:57 PM.
-
Jul 16th, 2005, 09:13 PM
#21
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
I doubled click the winmysqladmin.exe and still got the warnings and error. I restarted apache and still got the errors.
Then i tryed doing what it says in that tutorail by open coammand and doing this command "C:\mysql\bin>mysqld-nt --install "
I did that and it said
The service already exists!
The current server installed: "C:\Mysql\bin\mysqld-nt" --defaults-file="C:\Mysql
\my.ini" MySQL
tryed running the page again but just gpt warnings and errors.
ACDC
Are the best band ever!
-
Jul 17th, 2005, 02:04 AM
#22
Re: Installing PHP, Apache,Mysql
If you are using named pipes for mysql then you need to use the hostname "." instead of localhost to connect to the server.
-
Jul 17th, 2005, 05:19 AM
#23
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
What is named pipes?
I changed it anyway and the following came up:-
Warning: mysql_connect() [function.mysql-connect]: Can't open named pipe to host: . pipe: .;c:\PHP\PEAR\;C:\Program Files\ (2) in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 9
Warning: mysql_query() [function.mysql-query]: Can't connect to MySQL server on 'localhost' (10061) in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 11
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 11
Error 2003: Can't connect to MySQL server on 'localhost' (10061)
ACDC
Are the best band ever!
-
Jul 17th, 2005, 06:04 AM
#24
Re: Installing PHP, Apache,Mysql
before changing the hostname to "." did you start your mysql server as per my last post?
-
Jul 17th, 2005, 05:17 PM
#25
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
 Originally Posted by lintz
before changing the hostname to "." did you start your mysql server as per my last post?
I tryed in command but it just some up with
C:\MYSQL\BIN>mysqld-nt --install
The service already exists!
The current server installed: "C:\Mysql\bin\mysqld-nt" --defaults-file="C:\Mysq
\my.ini" MySQL
ACDC
Are the best band ever!
-
Jul 17th, 2005, 05:21 PM
#26
Re: Installing PHP, Apache,Mysql
There is a difference between installing and starting a service. Press Control+Alt+Delete and press the task manager, check the process list for mysql-nt.exe. If its not there you need to start the service. You can do this in the command line by typing net start mysql
-
Jul 17th, 2005, 06:58 PM
#27
Thread Starter
New Member
Re: Installing PHP, Apache,Mysql
Ok it's started i try run mysql_up.php through browser can get:-
Warning: mysql_connect() [function.mysql-connect]: Can't open named pipe to host: . pipe: .;c:\PHP\PEAR\;C:\Program Files\ (2) in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 9
Warning: mysql_query() [function.mysql-query]: Can't connect to MySQL server on 'localhost' (10061) in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 11
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 11
Error 2003: Can't connect to MySQL server on 'localhost' (10061)
Still!!
ACDC
Are the best band ever!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|