PDA

View Full Version : mysql-php-application crashed



stonix
12-08-2004, 11:56 AM
Hello,

i have a apache+mysql+php-web-application, it works fine on my linux and windows box, but after i transfer it to WH Server, it crashed with
error msg: "Segmentation fault" in /var/log/httpd/error_log.
I'm wondering is, i can via web log into my mysql server, but if i click
further links to view my data in mysql db, then it crashed. And i really
do not know how can i begin with this fatal error.
So i think here is a good place to get some helpfully tips and ideas...

jalal
12-08-2004, 02:07 PM
This is a great place for helpfully tips and ideas.

But, you'll need to give us a little more information. :)

When you say you "log into my mysql server", does that mean you are logging in through PhpMyAdmin? And is it PhpMyAdmin that is crashing?

Quite often a segmentation fault is created when your Php script is calling a library or module outside of the PHP runtime, possibly using an exec call or by dynamically loading a module. Is your script doing either of these?

stonix
12-09-2004, 08:14 AM
thanks for reply. Well i said i can log into my mysql server, did not mean
logging in through PhpMyAdmin, but my web application interface.
Through PhpMyAdmin I can also logging into my db without problem.
And i can view my data in my DB via PhpMyAdmin without problem.
I'm afraid that the PHP script in my aplication has trouble with WH enviroment.
But how can i debug it, because the error msg "Segmentation fault " is too short and too brutal for me.

FZ
12-09-2004, 10:43 AM
Have you checked the PHP error log? Not sure if it logs by default, but you can turn it on (you'll need to search for the post that describes how to do that) and then check: /var/log/php-error-log

wildjokerdesign
12-09-2004, 03:11 PM
If you want to turn on logging just for the script you are working with and not for all php scripts you can use the following at the top of your script.

ini_set("error_log", "/path/to/php_error_log");
ini_set("log_errors", 1);

The path to where you want php_error_log can be what ever you want it to be but I normally set it to the directory in wich the php page is that I am working on.

You can set this for all your php scripts in the php.ini you are looking for the following.


log_errors = Off
;error_log = filename

The error_log is for the path and is down the page a bit from log_errors. You want to change log_errors to On and then uncomment error_log and set the path.

stonix
12-10-2004, 01:02 AM
even though i added "ini_set" code, i could not see any error msg in the
error log i set when it crashed.

following is the php crashed "subp.php": it will be referenced as
http://mydomain.com/project/subp.php?pn=main3
btw, if i run "php subp.php" in the shell on WH, it did not crash.



<?
ini_set("error_log", "/var/log/php_error_log");
ini_set("log_errors", 1);

require_once 'includes/header.inc.php';
if ($_LOGGED != 'Logged') header ('Location: /');

require_once 'includes/subpage_class.inc.php';
require_once 'includes/mysql_class.inc.php';

rass="code">quire ('includes/ifp.inc.php');
$side_filling = $proc_index;
$inc = ($pn) ? 'sub_func_index.inc' : 'index.inc';

$deny_msg = "<br><font color=red>Permission Denied!<br>you don't have permission to use this function.</font>";

$filling_data['{theTitle}'] = $theTitle;
$filling_data['{subproc_index}'] = ($permission == 'denied') ? $deny_msg : $subproc_index;

require 'includes/page.inc.php';
?>

wildjokerdesign
12-10-2004, 08:12 AM
rass="code">quire ('includes/ifp.inc.php');

What is happening here? Did you mean to require and not quire? Also are you trying to set $rass ? You have no $.

stonix
12-10-2004, 09:33 AM
Sorry, something went wrong while copy&paste. here the code again.


<?
ini_set("error_log", "/var/log/php_error_log");
ini_set("log_errors", 1);

require_once 'includes/header.inc.php';
if ($_LOGGED != 'Logged') header ('Location: /');

require_once 'includes/subpage_class.inc.php';
require_once 'includes/mysql_class.inc.php';

require ('includes/ifp.inc.php');
$side_filling = $proc_index;
$inc = ($pn) ? 'sub_func_index.inc' : 'index.inc';

$deny_msg = "<br><font color=red>Permission Denied!<br>you don't have permission to use this function.</font>";

$filling_data['{theTitle}'] = $theTitle;
$filling_data['{subproc_index}'] = ($permission == 'denied') ? $deny_msg : $subproc_index;

require 'includes/page.inc.php';
?>

wildjokerdesign
12-10-2004, 11:23 AM
I don't think there is anything wrong with the above code. I duplicated the code commenting out all the requires and got no errors. Could the problem be in one of the files you are calling with require or require_once? I was haveing some problems on a script that was connecting to a database and found a mistake in my connection to the database. Is there maybe something in your mysql_class.inc.php that is wrong?

Take a look at this page and see if it helps http://cs-www.bu.edu/help/unix/segmentation_fault.html. I'm not sure if it is relevant but thought I would pass it on. Sorry I can't be more help.

stonix
12-10-2004, 02:35 PM
actually the codes should be ok, because it works on my linux and window
box at home, but only not on WH. I think it's time to ask WH direct.

jalal
12-11-2004, 02:19 PM
Let us know what you find out.

:)

stonix
04-07-2005, 07:13 AM
OK, after i upgraded the PHP, everthing is fine now.