|
-
Jan 4th, 2010, 05:19 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Problem wamp on MS Vista Home Premium
Wasn't sure where to post this but it seems php related.
Have recently got a lappie with Vista pre installed. Yesterday added the wamp application to continue developing in php/mysql. Okay normal web pages are working fine, but as soon as a spot of php/mysql code is added apache stops working and looks to be trying to do something with the php setup?????
Anyone hit this problem, and if so how the heck do you beat it into submission. My former PC is running XP Pro and the same php pages are executing just fine on that rig.
SOmehow I can't help but think this is some mactard's fault
-
Jan 4th, 2010, 05:25 PM
#2
Re: Problem wamp on MS Vista Home Premium
This would be better in the General PC forum since you're more likely get support for it there. Ask a moderator to move it for you, if you can 
Cheers.
-
Jan 4th, 2010, 06:32 PM
#3
Re: Problem wamp on MS Vista Home Premium
Thread moved as requested.
-
Jan 4th, 2010, 06:32 PM
#4
Re: Problem wamp on MS Vista Home Premium
I doubt it would be better suited for the General PC forum since this is not a General PC problem.
[edit: I guess this was moved anyway. well, whatever -- I still don't think this belongs in the General PC forum]
this is a problem I've experienced in the past, though it was so long ago that I can't remember what the exact cause of it was. also, I've never used WAMP or any of the other install packages, and I install everything manually, so I don't know what those install packages do. I feel this will be quite useless if you're not installing from scratch, but here are a few things that I make sure to do when installing PHP with Apache:
First of all, before doing anything, try to find out why Apache is crashing. In the Apache installation directory, there is a subdirectory with log files (access, error, and install logs). The error log file could help you narrow down the problem. If this is of no help, you might also look at the Windows Event Viewer (Start->Administrative Tools->Event Viewer). Under the Windows Logs, under Applications, you can look if the Apache service is giving any errors. This could also help you narrow down any issues.
Make sure Apache is loading the right extension
Somewhere inside of your httpd.conf file (located in your Apache installation folder -- /apache/conf/httpd.conf), you should have something like the following (with PHP5 and Apache 2.2) [I'd recommend doing a "Find" on php5_module to find this entry):
Code:
LoadModule php5_module "c:/php5.2.11/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php5.2.11"
Make sure Apache is loading php5apache2_2.dll and not php5apache2.dll. Also, I'd make sure the PHPIniDir directive is set. c:/php/5.2.11/ is the full path to my PHP installation.
Setting up PHP in the Windows Path environment variable
when installing PHP (I install PHP with the zip packages, not the installer) you need to make sure that the directory you install PHP to (clarification: the directory you unzip PHP into) is in the Windows PATH environment variable. In Windows Vista/7, you should be able to go to the start menu, right click on Computer and go to Properties, then click on Advanced System Settings, and then click the Environment Variables button at the bottom of that dialog. Under the System Variables label, there is a variable named Path. When you select it, you can click Edit and add onto the string already there. This is a semi-colon delimited string, so you must add a semi-colon if there isn't one at the very end of the string already. Then, add the full path to your PHP installation; mine, for example, is "C:\php5.2.11\".
If you find anything in the Apache error log that looks suspicious or in the Windows Event Viewer, feel free to post it.
-
Jan 4th, 2010, 08:24 PM
#5
Re: Problem wamp on MS Vista Home Premium
@KiwiDexter,
Is the error you are receiving above apache stopped working this one?
Apache HTTP Server has encountered a problem and needs to close. We are sorry for the inconvenience.
If so and you have:
In your code try removing it and see if that helps.
Source
What code are you using?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Jan 4th, 2010, 08:27 PM
#6
Thread Starter
Hyperactive Member
Re: Problem wamp on MS Vista Home Premium
Sorry don't have the PC in front of me to get the error message.
Apache is shutting down with an error in the log. something to the effect that it needs to re-initialise php or something.
Haven't had time to sit down and see where exactly in the script it's getting it's knickers in a knot, but would appear to be happily connecting to Mysql so think it may be one a data read that things are going wrong.
-
Jan 4th, 2010, 08:42 PM
#7
Re: Problem wamp on MS Vista Home Premium
Well, if it is caused by the close statement mentioned above like in my case:
PHP Code:
<?php $hostname = "localhost"; $database = "custdb"; $user = "user"; $pass = "password"; //Connect $mysql_link = mysql_connect($hostname, $user,$pass) or die ("Unable to connect to mysql server!"); mysql_select_db ($database,$mysql_link) or die ("Unable to select database!"); ?>
Try using:
PHP Code:
mysql_close($mysql_link); //Whatever you have as the connection variable goes in the brackets
Instead of:
The close statement on its own seems to cause problems using apache 2.2.11, php 5.3.0.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Jan 4th, 2010, 09:22 PM
#8
Thread Starter
Hyperactive Member
Re: Problem wamp on MS Vista Home Premium
 Originally Posted by Nightwalker83
Well, if it is caused by the close statement mentioned above like in my case:
PHP Code:
<?php
$hostname = "localhost";
$database = "custdb";
$user = "user";
$pass = "password";
//Connect
$mysql_link = mysql_connect($hostname, $user,$pass) or die ("Unable to connect to mysql server!");
mysql_select_db ($database,$mysql_link) or die ("Unable to select database!");
?>
Try using:
PHP Code:
mysql_close($mysql_link); //Whatever you have as the connection variable goes in the brackets
Instead of:
The close statement on its own seems to cause problems using apache 2.2.11, php 5.3.0.
Dude!!!! Pretty sure we use mysql_close() but our XP box is on an old version of apache ... will try this one out
-
Jan 5th, 2010, 01:35 PM
#9
Re: Problem wamp on MS Vista Home Premium
you don't need to ever call mysql_close(), just FYI. PHP will close any open MySQL connections itself.
-
Jan 5th, 2010, 04:48 PM
#10
Thread Starter
Hyperactive Member
Re: Problem wamp on MS Vista Home Premium
 Originally Posted by kows
you don't need to ever call mysql_close(), just FYI. PHP will close any open MySQL connections itself.
We have very specific coding standards due to a number of different people working in different time zones. When I read a mysql_close() statement in a script I immediatly think "aha end of db requirements", it's sort of a self documenting feature don't you think?
Nightwalker spot on mate Added the db variable to the close and she's working like a brought one. Now we just need tor re-sync code from three different development machines and we're good to go ... until the Win 7 stuff arrives
-
Jan 5th, 2010, 06:22 PM
#11
Re: Problem wamp on MS Vista Home Premium
 Originally Posted by kows
you don't need to ever call mysql_close(), just FYI. PHP will close any open MySQL connections itself.
I suppose the "?>" tag tells the code that it is the end of the code and to close the connection? That would seem logical.
 Originally Posted by KiwiDexter
We have very specific coding standards due to a number of different people working in different time zones. When I read a mysql_close() statement in a script I immediatly think "aha end of db requirements", it's sort of a self documenting feature don't you think?
Nightwalker spot on mate  Added the db variable to the close and she's working like a brought one. Now we just need tor re-sync code from three different development machines and we're good to go ... until the Win 7 stuff arrives 
The code will work on Win 7 at least until version 6.0.0 of php. Although, I haven't checked to see if the close statement has been removed in version 6.0.0 or not.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Jan 5th, 2010, 06:25 PM
#12
Thread Starter
Hyperactive Member
Re: Problem wamp on MS Vista Home Premium
 Originally Posted by Nightwalker83
I suppose the "?>" tag tells the code that it is the end of the code and to close the connection? That would seem logical.
Quite often we have close the db connection but the script has quite some more lines to get through for various things.
The code will work on Win 7 at least until version 6.0.0 of php. Although, I haven't checked to see if the close statement has been removed in version 6.0.0 or not.
Don't even mention v6 of php, still getting up to speed with 5 LOL
Thanks for the help would never have picked the close statement as being the source of our error.
-
Jan 5th, 2010, 07:26 PM
#13
Re: [RESOLVED] Problem wamp on MS Vista Home Premium
the mysql_close() function is not being removed -- it's just unnecessary for non-persistent connections (the PHP documentation tells you this). PHP automatically closes non-persistent connections (created with mysql_connect(), rather than mysql_pconnect()). mysql_close() will never close a persistent connection (and thus is completely unnecessary when using mysql_pconnect()).
Kiwi: unless your scripts are incredibly resource intensive, I honestly don't think it would ever be necessary to force close a MySQL connection just so the script finishes without that connection. but to each their own, if you think (or your company thinks) you need it.
-
Jan 5th, 2010, 08:10 PM
#14
Re: [RESOLVED] Problem wamp on MS Vista Home Premium
 Originally Posted by KiwiDexter
Don't even mention v6 of php, still getting up to speed with 5 LOL
Yeah, I haven't used version 6.0.0 either, the php manual mentions the functions, that have been removed, changed though.
 Originally Posted by kows
the mysql_close() function is not being removed --
Ah ok! I don't use the close statement anymore anyway.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Jan 7th, 2010, 07:21 PM
#15
Thread Starter
Hyperactive Member
Re: [RESOLVED] Problem wamp on MS Vista Home Premium
 Originally Posted by kows
the mysql_close() function is not being removed -- it's just unnecessary for non-persistent connections (the PHP documentation tells you this). PHP automatically closes non-persistent connections (created with mysql_connect(), rather than mysql_pconnect()). mysql_close() will never close a persistent connection (and thus is completely unnecessary when using mysql_pconnect()).
Kiwi: unless your scripts are incredibly resource intensive, I honestly don't think it would ever be necessary to force close a MySQL connection just so the script finishes without that connection. but to each their own, if you think (or your company thinks) you need it.
Not necesary but it is a standard and does have a purpose for our application.
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
|