我刚刚升级到PHP5 - 一切都被弃用了,Apache是​​空白的

时间:2015-01-12 08:37:02

标签: php nginx apache2 deprecated php-5.5

我不知道我之前使用的是什么版本的PHP,但我猜它是旧版本,因为它在我从Nginx切换到Apache之前工作得很好。我想我在Nginx上使用的是旧版本的PHP。无论如何这是一个据说被弃用的代码示例。我现在使用PHP 5.5.9。

<?php
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$connection = mysql_connect("localhost", "username", "password");
// Selecting Database
$db = mysql_select_db("database", $connection);
session_start();// Starting Session
// Storing Session
$user_check=$_SESSION['login_user'];
// SQL Query To Fetch Complete Information Of User
$ses_sql=mysql_query("select name from table where name='$user_check'", $connection);
$row = mysql_fetch_assoc($ses_sql);
$login_session =$row['name'];
if(!isset($login_session)){
mysql_close($connection); // Closing Connection
header('Location: index.php'); // Redirecting To Home Page
}
?>

我的所有页面都使用与此类似的PHP代码,所以我只想发布其中一个。这是我的错误日志。

[Mon Jan 12 03:03:40.456254 2015] [mpm_event:notice] [pid 2415:tid 3074542208] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon Jan 12 03:03:40.456344 2015] [core:notice] [pid 2415:tid 3074542208] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 12 03:04:42.038619 2015] [mpm_event:notice] [pid 2415:tid 3074542208] AH00491: caught SIGTERM, shutting down
[Mon Jan 12 03:04:43.100702 2015] [mpm_prefork:notice] [pid 3617] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon Jan 12 03:04:43.100786 2015] [core:notice] [pid 3617] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 12 03:04:44.344041 2015] [mpm_prefork:notice] [pid 3617] AH00169: caught SIGTERM, shutting down
[Mon Jan 12 03:04:45.489917 2015] [mpm_prefork:notice] [pid 3708] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
[Mon Jan 12 03:04:45.489959 2015] [core:notice] [pid 3708] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 12 03:06:19.837552 2015] [mpm_prefork:notice] [pid 3708] AH00169: caught SIGTERM, shutting down
[Mon Jan 12 03:06:20.873964 2015] [mpm_prefork:notice] [pid 3925] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
[Mon Jan 12 03:06:20.874005 2015] [core:notice] [pid 3925] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 12 03:07:37.795009 2015] [:error] [pid 3932] [client 108.162.238.215:57356] script '/var/www/html/info.php' not found or unable to stat
[Mon Jan 12 03:09:01.713565 2015] [:error] [pid 3928] [client 108.162.238.215:28781] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4
[Mon Jan 12 03:09:06.002298 2015] [:error] [pid 3928] [client 108.162.238.215:28781] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4
[Mon Jan 12 03:09:17.906216 2015] [:error] [pid 3946] [client 108.162.238.215:64299] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4
[Mon Jan 12 03:09:23.456198 2015] [:error] [pid 3931] [client 108.162.238.215:36456] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4, referer: https://epicmc.us/404.php
[Mon Jan 12 03:09:26.631794 2015] [:error] [pid 3931] [client 108.162.238.215:36456] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4, referer: https://epicmc.us/404.php
[Mon Jan 12 03:09:55.207111 2015] [mpm_prefork:notice] [pid 3925] AH00169: caught SIGTERM, shutting down
[Mon Jan 12 03:09:55.300465 2015] [mpm_prefork:notice] [pid 3996] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
[Mon Jan 12 03:09:55.300511 2015] [core:notice] [pid 3996] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 12 03:09:59.717164 2015] [:error] [pid 4001] [client 108.162.238.215:16174] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4, referer: https://epicmc.us/404.php
[Mon Jan 12 03:10:25.281382 2015] [:error] [pid 4002] [client 108.162.238.215:18754] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4
[Mon Jan 12 03:11:03.812550 2015] [:error] [pid 3999] [client 108.162.238.215:47026] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4
[Mon Jan 12 03:11:39.560256 2015] [:error] [pid 4016] [client 108.162.238.215:28585] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4
[Mon Jan 12 03:14:36.371451 2015] [:error] [pid 4001] [client 108.162.238.215:29588] PHP Notice:  Undefined index: player in /var/www/html/stats.php on line 7
[Mon Jan 12 03:14:36.387589 2015] [:error] [pid 4017] [client 63.142.248.45:58023] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/api.php on line 9
[Mon Jan 12 03:14:36.387889 2015] [:error] [pid 4001] [client 108.162.238.215:29588] PHP Warning:  file_get_contents(http://epicmc.us/api.php?task=stats&amp;player=): failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error\r\n in /var/www/html/stats.php on line 7
[Mon Jan 12 03:14:36.387942 2015] [:error] [pid 4001] [client 108.162.238.215:29588] PHP Notice:  Undefined index: player in /var/www/html/stats.php on line 10
[Mon Jan 12 03:14:36.387956 2015] [:error] [pid 4001] [client 108.162.238.215:29588] PHP Notice:  Undefined index: player in /var/www/html/stats.php on line 20
[Mon Jan 12 03:14:36.388029 2015] [:error] [pid 4001] [client 108.162.238.215:29588] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4
[Mon Jan 12 03:14:40.516471 2015] [:error] [pid 4001] [client 108.162.238.215:29588] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/api.php on line 9
[Mon Jan 12 03:16:26.882760 2015] [:error] [pid 4003] [client 108.162.214.137:51884] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4, referer: https://epicmc.us
[Mon Jan 12 03:18:35.605165 2015] [mpm_prefork:notice] [pid 3996] AH00169: caught SIGTERM, shutting down
[Mon Jan 12 03:18:36.649524 2015] [mpm_prefork:notice] [pid 4105] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
[Mon Jan 12 03:18:36.649586 2015] [core:notice] [pid 4105] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 12 03:18:40.845243 2015] [:error] [pid 4111] [client 108.162.238.215:26322] PHP Notice:  Undefined index: player in /var/www/html/stats.php on line 7
[Mon Jan 12 03:18:40.849347 2015] [:error] [pid 4112] [client 63.142.248.45:34942] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/api.php on line 9
[Mon Jan 12 03:18:40.849619 2015] [:error] [pid 4111] [client 108.162.238.215:26322] PHP Warning:  file_get_contents(http://epicmc.us/api.php?task=stats&amp;player=): failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error\r\n in /var/www/html/stats.php on line 7
[Mon Jan 12 03:18:40.849660 2015] [:error] [pid 4111] [client 108.162.238.215:26322] PHP Notice:  Undefined index: player in /var/www/html/stats.php on line 10
[Mon Jan 12 03:18:40.849671 2015] [:error] [pid 4111] [client 108.162.238.215:26322] PHP Notice:  Undefined index: player in /var/www/html/stats.php on line 20
[Mon Jan 12 03:18:40.850012 2015] [:error] [pid 4111] [client 108.162.238.215:26322] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 4
[Mon Jan 12 03:22:59.264503 2015] [:error] [pid 4110] [client 108.162.238.215:39205] PHP Fatal error:  Call to undefined function mysqli_connect() in /var/www/html/session.php on line 3
[Mon Jan 12 03:25:15.361204 2015] [:error] [pid 4109] [client 108.162.238.215:31116] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 3
[Mon Jan 12 03:26:55.673865 2015] [:error] [pid 4108] [client 108.162.238.215:44137] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 3
[Mon Jan 12 03:26:59.193970 2015] [:error] [pid 4112] [client 108.162.238.215:43815] PHP Notice:  Undefined index: player in /var/www/html/stats.php on line 7
[Mon Jan 12 03:26:59.197756 2015] [:error] [pid 4125] [client 63.142.248.45:44475] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/api.php on line 9
[Mon Jan 12 03:26:59.197950 2015] [:error] [pid 4112] [client 108.162.238.215:43815] PHP Warning:  file_get_contents(http://epicmc.us/api.php?task=stats&amp;player=): failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error\r\n in /var/www/html/stats.php on line 7
[Mon Jan 12 03:26:59.197982 2015] [:error] [pid 4112] [client 108.162.238.215:43815] PHP Notice:  Undefined index: player in /var/www/html/stats.php on line 10
[Mon Jan 12 03:26:59.197992 2015] [:error] [pid 4112] [client 108.162.238.215:43815] PHP Notice:  Undefined index: player in /var/www/html/stats.php on line 20
[Mon Jan 12 03:26:59.198047 2015] [:error] [pid 4112] [client 108.162.238.215:43815] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/session.php on line 3
[Mon Jan 12 03:27:03.942299 2015] [:error] [pid 4111] [client 108.162.238.215:51061] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/api.php on line 9
[Mon Jan 12 03:27:16.010513 2015] [:error] [pid 4110] [client 108.162.238.215:42175] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/html/api.php on line 9

如果那里有人可以重新编写上面以PHP 5格式发布的整个PHP代码,以便我知道从哪里开始那将是非常棒的。目前Apache2只是一个空白站点,只有几个HTML元素在这里和那里工作。对不起,如果这听起来像一个菜鸟问题,我真的很喜欢参考。

有两个php.ini文件。一个是在/ etc / php5 / apache2

PHP INI外部附着因为我没有足够的房间在这里发布

http://pastebin.com/UpwuC2Hj

1 个答案:

答案 0 :(得分:0)

您似乎缺少php的mysql模块。安装它们应该让您的网站重新启动,然后您就可以开始升级您的代码了。

阅读ini文件动态扩展程序部分中的注释,并取消注释正确的行。