473,378 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

mysql apache - page never finish loading


Hi all,

I am new to PHP, Apache and Mysql. But I least I have managed to
install everything on my home computer on my own and everything is up
and running. I can fetch data from the database and display it. So far,
so good.

However, I'm stuck on an irritating problem. Whenever I connect to
mysql, my PHP pages don't want to finish loading. In the following
example, the page will not finish loading nor display "abc" until I
interupt by pressing "Stop" in the web browser".

<?php
echo 'a';
$link = mysql_connect('localhost', 'user', 'pwd');
echo 'b';
mysql_close($link);
echo 'c';
?>

I am running Apache 2.2.2 and Mysql 5.0.

Any help appreciated.

-Anders Bondensson

Jul 8 '06 #1
6 2993
*** th*********@my-deja.com escribió/wrote (8 Jul 2006 03:22:00 -0700):
However, I'm stuck on an irritating problem. Whenever I connect to
mysql, my PHP pages don't want to finish loading. In the following
example, the page will not finish loading nor display "abc" until I
interupt by pressing "Stop" in the web browser".

<?php
echo 'a';
$link = mysql_connect('localhost', 'user', 'pwd');
echo 'b';
mysql_close($link);
echo 'c';
?>
Your code looks flawless to me. I'd say the problem could be in third-party
software, such as:

- Antivirus
- Firewall
- Proxy
....

If you are using Windows, there's an Apache directive you can try (add it
to httpd.conf file):

EnableSendfile Off
EnableMMAP Off
Win32DisableAcceptEx

This seems to fix some Windows specific problems. If it works for you
please let me know.
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Jul 8 '06 #2

Alvaro G. Vicario skrev:
*** th*********@my-deja.com escribió/wrote (8 Jul 2006 03:22:00 -0700):
However, I'm stuck on an irritating problem. Whenever I connect to
mysql, my PHP pages don't want to finish loading. In the following
example, the page will not finish loading nor display "abc" until I
interupt by pressing "Stop" in the web browser".

<?php
echo 'a';
$link = mysql_connect('localhost', 'user', 'pwd');
echo 'b';
mysql_close($link);
echo 'c';
?>

Your code looks flawless to me. I'd say the problem could be in third-party
software, such as:

- Antivirus
- Firewall
- Proxy
...

If you are using Windows, there's an Apache directive you can try (add it
to httpd.conf file):

EnableSendfile Off
EnableMMAP Off
Win32DisableAcceptEx

This seems to fix some Windows specific problems. If it works for you
please let me know.
Thank for your help. Unfortunately this did not fix the problem. I have
added the above lines to the httpd.conf file, i have inactivated both
firewall and anti virus, all in various combinations. Not sure what to
do with the proxy server. Don't think I am using one, but I could be
mistaken.

Opera and IE behaves somewhat differently. With Opera, the "abc" will
be displayed when I press "stop" in the browser. For IE, "abc" will
never be displayed. The page will just not load.

All this happens whenver I connect to mysql. Regular html or php pages
will load happily.

-Anders Bondensson

Jul 9 '06 #3
i would stick in an ' or die (mysql_error ()); ' at the end of the
statement, probably is coming across an error but for some reason keeps
trying.. you really should have that on all your sql queries.

Flamer.

th*********@my-deja.com wrote:
Alvaro G. Vicario skrev:
*** th*********@my-deja.com escribió/wrote (8 Jul 2006 03:22:00 -0700):
However, I'm stuck on an irritating problem. Whenever I connect to
mysql, my PHP pages don't want to finish loading. In the following
example, the page will not finish loading nor display "abc" until I
interupt by pressing "Stop" in the web browser".
>
<?php
echo 'a';
$link = mysql_connect('localhost', 'user', 'pwd');
echo 'b';
mysql_close($link);
echo 'c';
?>
Your code looks flawless to me. I'd say the problem could be in third-party
software, such as:

- Antivirus
- Firewall
- Proxy
...

If you are using Windows, there's an Apache directive you can try (add it
to httpd.conf file):

EnableSendfile Off
EnableMMAP Off
Win32DisableAcceptEx

This seems to fix some Windows specific problems. If it works for you
please let me know.

Thank for your help. Unfortunately this did not fix the problem. I have
added the above lines to the httpd.conf file, i have inactivated both
firewall and anti virus, all in various combinations. Not sure what to
do with the proxy server. Don't think I am using one, but I could be
mistaken.

Opera and IE behaves somewhat differently. With Opera, the "abc" will
be displayed when I press "stop" in the browser. For IE, "abc" will
never be displayed. The page will just not load.

All this happens whenver I connect to mysql. Regular html or php pages
will load happily.

-Anders Bondensson
Jul 9 '06 #4
Mel
On 2006-07-10 10:00:41 +1000, "flamer di******@hotmail.com"
<di******@hotmail.comsaid:
i would stick in an ' or die (mysql_error ()); ' at the end of the
statement, probably is coming across an error but for some reason keeps
trying.. you really should have that on all your sql queries.

Flamer.

I'm curious: why should you always have one on SQL function calls? I
never use them and opt for things like:

$link = @mssql_connect(CONNECTION_STUFF_HERE);
if ($link === false) {
// handle error
}
if (@mssql_select_db(DBNAME,$link) === false) {
// handle error
}
$sql = "select * from myTable";
$res = @mssql_query($res);
if ($res === false) {
// handle error
}

Normally this'd be in a class and '// handle error' would throw an
Exception. This method is used heavily in my production environment and
has yet to fail me. I'm not poo-pooing the idea of the die() or exit()
functions inline with the SQL functions, just wondering why they should
be used.

Jul 11 '06 #5
Mel wrote:
On 2006-07-10 10:00:41 +1000, "flamer di******@hotmail.com"
<di******@hotmail.comsaid:
>i would stick in an ' or die (mysql_error ()); ' at the end of the
statement, probably is coming across an error but for some reason keeps
trying.. you really should have that on all your sql queries.

Flamer.

I'm curious: why should you always have one on SQL function calls? I
never use them and opt for things like:

$link = @mssql_connect(CONNECTION_STUFF_HERE);
if ($link === false) {
// handle error
}
if (@mssql_select_db(DBNAME,$link) === false) {
// handle error
}
$sql = "select * from myTable";
$res = @mssql_query($res);
if ($res === false) {
// handle error
}

Normally this'd be in a class and '// handle error' would throw an
Exception. This method is used heavily in my production environment and
has yet to fail me. I'm not poo-pooing the idea of the die() or exit()
functions inline with the SQL functions, just wondering why they should
be used.
Mel,

I'm with you. I don't use "or die..." either. I'd rather check the
results, and if they aren't good, handle the problem.

It's very unsettling to a user to have your pages break because of some
minor database problem. It's even worse to have the error message
displayed in their browser. Better to log the error and put up
something like "I'm sorry but we're having problems right now" type of
message.

And for production machines I can even have it email me the error so I
know something bad happened. Saves having to look through error logs.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 11 '06 #6
Hi Flamer,

The problem is not lack of error handling, and the snippet I submitted
was just to illustrate the point. I am pretty sure that my problem
isn't the PHP code itself. Rather it has something to do with the
settings on the computer I am using at home. Firewalls, anitvirus, and
such, as suggested earlier, seemed like a possible source of my
problems, but unfortunately it didn't help to turn it all off.

I was hoping that this was some kind of "known problem" when using PHP
and mysql, but I guess I had no such luck.

Anyway, thanks for your efforts!

-Anders Bondensson

flamer di******@hotmail.com skrev:
i would stick in an ' or die (mysql_error ()); ' at the end of the
statement, probably is coming across an error but for some reason keeps
trying.. you really should have that on all your sql queries.

Flamer.

th*********@my-deja.com wrote:
Alvaro G. Vicario skrev:
*** th*********@my-deja.com escribió/wrote (8 Jul 2006 03:22:00 -0700):
However, I'm stuck on an irritating problem. Whenever I connect to
mysql, my PHP pages don't want to finish loading. In the following
example, the page will not finish loading nor display "abc" until I
interupt by pressing "Stop" in the web browser".

<?php
echo 'a';
$link = mysql_connect('localhost', 'user', 'pwd');
echo 'b';
mysql_close($link);
echo 'c';
?>
>
Your code looks flawless to me. I'd say the problem could be in third-party
software, such as:
>
- Antivirus
- Firewall
- Proxy
...
>
If you are using Windows, there's an Apache directive you can try (add it
to httpd.conf file):
>
EnableSendfile Off
EnableMMAP Off
Win32DisableAcceptEx
>
This seems to fix some Windows specific problems. If it works for you
please let me know.
Thank for your help. Unfortunately this did not fix the problem. I have
added the above lines to the httpd.conf file, i have inactivated both
firewall and anti virus, all in various combinations. Not sure what to
do with the proxy server. Don't think I am using one, but I could be
mistaken.

Opera and IE behaves somewhat differently. With Opera, the "abc" will
be displayed when I press "stop" in the browser. For IE, "abc" will
never be displayed. The page will just not load.

All this happens whenver I connect to mysql. Regular html or php pages
will load happily.

-Anders Bondensson
Jul 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pancho | last post by:
Greetings, I need help configuring/building PHP3 with MySQL as a DSO on a Solaris 8 box - this module is needed to host some existing sites I will be migrating Note. I built PHP4 from source and...
0
by: admin | last post by:
I have apache 2.0 install and mysql 4.0 installed. What I want is to be able to use phpmyadmin to adminstrate the database. However the problem I am running into is that the version of php that...
0
by: Mitch | last post by:
Here is the basic scenario: - Configuration data is gathered from Oracle servers then ftp'd to my apache / mysql server. - The apache / mysql server receives the datafile from the Oracle...
0
by: RonS | last post by:
I'm having a little trouble getting MySQL to load with Apache. Apache and PHP are working OK, but MySQL isn't loading. I know php.ini is loading because the following lines are in php.ini: ...
5
by: Tom Martin | last post by:
I'm a Java Web developer NEWBIE that has inherited a website that fails every 2 hours due to poor connection pooling between Tomcat 4.0.6 and mySQL. In efforts to resolve this problem, I've...
20
by: John Wells | last post by:
Yes, I know you've seen the above subject before, so please be gentle with the flamethrowers. I'm preparing to enter a discussion with management at my company regarding going forward as either...
18
by: Bruce A. Julseth | last post by:
I have the following code $Host = "localhost"; $User = "Fred"; $Database = "house"; $Password = "mypw" echo "before mysqli<br />Host: " . $Host . "<br />" . $User . "<br />" . $Database;
3
by: The alMIGHTY N | last post by:
I have an XSL file that works with a typically large XML data set generated dynamically from a database. This data is written to the HTML result as a deep multi-dimensional array that is used by...
17
dbrewerton
by: dbrewerton | last post by:
Hello all. This script I have did work on linux/apache and my service provider has told me the cgi-handler has been properly set up. I am able to get hello world test to display to a web page. My...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.