Elxis CMS Forum

Support => Installation => Topic started by: MrCompTech on January 27, 2010, 01:04:50

Title: HTTP Error 500.0 - Internal Server Error
Post by: MrCompTech on January 27, 2010, 01:04:50
When using FireFox 3.5.7 on the servers' console. I recieve the error message "HTTP Error 500.0 - Internal Server Error" when I try to open the web site for installation.
My server (not hosted) is Windows 2008 R2 Ent, IIS7, PHP 5.3.1, MySQL 5.1.42 x64.

I recieve the same eror message when I try to open phpinfo.php that is in the web server root "C:\inetpub\wwwroot" which is were the contents of Elxis were unzipped to, in other words /wwwroot not /wwwroot/elxis. When I disable "magic_quotes_gps" in php.ini the phpinfo.php displays correctly and I can proceed furthur through the Elexis installation. In step one of course there is a red 'Off' beside "Magic Quotes GPC" under "Recommended Settings". All other items are green.

The installation script recommends disabling several php functions which I do disable in the php.ini file.

Step 2 - proceeds ok, Step 3 - proceeds ok.
Step 4 - After entering the database information and trying to proceed I receive the HTTP error 500.0 after 60 seconds.
If in php.ini I enable "display_errors" and try again I receive the error message :

Warning: mysql_connect(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\inetpub\wwwroot\includes\adodb\drivers\adodb-mysql.inc.php on line 364 Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\inetpub\wwwroot\includes\adodb\drivers\adodb-mysql.inc.php on line 364 Fatal error: Maximum execution time of 60 seconds exceeded in C:\inetpub\wwwroot\includes\adodb\drivers\adodb-mysql.inc.php on line 363

I have disabled the firewall ans still receive this message.
The database does exist and the user has proper privileges to the database.
No tables are created in the database.

When I check the IIS log files the usual log activity is seen for installation steps 1 through 3, but no log entries are present after clicking next on the step 4 page.

In MySQL the user has connection privileges under 'localhost' and under the local IP address as well.

I receive this error whether I am accessing the server from the server's console or from a network connected PC.

On the server I can use MySQL Administrator to connect to the database server using the same credentials provided in installation step 4.

Are "magic_quotes_gpc" required for Elexis? The installation script seems to indicate that even though this is preferred it is not a requirement.

If "magic_quotes_gpc" are not required to be "on" then does anyone have any ideas on what the problem could be or any information on how to troubleshoot this issue?

Does anyone know of IIS 7 supports using "magic_quotes_gpc" in PHP?

Thanks in advance!
Title: Re: HTTP Error 500.0 - Internal Server Error
Post by: MrCompTech on January 27, 2010, 02:44:43
Troubleshooting update:

To confirm settings I followed this document on configuring PHP using FastCGI on IIS 7.0
http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/ (http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/)

Recieved same results as first post for this topic.
Removed Elxis files and copied Mambo files into wwwroot, restarted web server and recieved HTTP 500.0 again, but with "display_errors" on in php.ini recieved the error message "Deprecated: Assigning the return value of new by reference is deprecated in C:\...\database.php on line 777.

But phpinfo.php test displays fine.
Title: Re: HTTP Error 500.0 - Internal Server Error
Post by: datahell on January 27, 2010, 09:32:40
Regarding "Magic Quotes GPC" the recommending setting was ON. From PHP 5.3 and especially from 6.0 the recommending setting is OFF.
Elxis still uses the old recommendation (ON). This will change in the future releases but before that we need to perform a security check on Elxis and ensure that it is safe to turn it OFF.

Regardless this, your problem is the connection to the database, it has nothing to do with Elxis recommendations for security. I your case I would create a small PHP script, 3-4 lines, to test db connectivity outside Elxis. Create a test file, name it test.php, and write in it:

Code: (php) [Select]
<?php 
$link 
mysql_connect(&#39;localhost&#39;, &#39;mysql_user&#39;, &#39;mysql_password&#39;);
if (!$link) {
    die(&
#39;Not connected : &#39; . mysql_error());
}

$db_selected mysql_select_db(&#39;database_name&#39;, $link);
if (!$db_selected) {
    
mysql_close($link);
    die (&
#39;Can not use selected database: &#39; . mysql_error());
}

echo &
#39;Connected successfully&#39;;
mysql_close($link);

?>

Change username, password, database_name with your own.
Access the test.php file from your browser.
If the result of the above is success then your db settings are fine.
Title: Re: HTTP Error 500.0 - Internal Server Error
Post by: MrCompTech on January 27, 2010, 16:16:33
   Thanks for the script. Could not make a connection to MySQL whe I used this script. Now I know it's not Elxis.
   I knew I was going to need something like this but I do very little scripting. Was planning on spending time today to learn just enough to do what you did. Thanks for the time saver. The script I'll put in my tool box!
   I have setup many web sites before using LAMP, WinXP & Vista + PHP & MySQL, but this was the first attempt on Windows Server 2008.

   I can make a connection to the MySQL server and create a table in the elxis database using MySQL Administrator. So this tends to make me think the problem lies with PHP, the PHP settings or the FastCGI settings for IIS 7. And since the phpinfo.php script runs normally the settings have to do with database connectivity. So this would indicate the problem has nothing to do with the FastCGI settings.

   What are the required PHP extensions needed for Elxis?
Title: Re: HTTP Error 500.0 - Internal Server Error
Post by: MrCompTech on January 27, 2010, 18:05:06
Well, this was interesting...

In the script I changed "localhost" to 127.0.0.1 and I connected immediatley!
When I ping localhost I recieve a response from the host's IPv6 virtual adapter even though IPv6 has been disabled on the hardware NICs.

The command "ipconfig /all" shows that there are two 'tunneling adapters' but show 'Media disconnected'. Not sure what these are for, perhaps they have something to do with this server's Hyper-V role which is installed.

I read in the documentation for various CMS that 98% of the time 'localhost' works as one of the settings when connecting to the MySQL database server. Well I guess I dropped into the 2% group. After changing "localhost" to the local IP address of the server the installation completed succdessfully.

When using 'MySQL Administrator' to connect to the database using 'localhost' there must be something in place to use 127.0.0.1 instead of resolving 'localhost' to '127.0.0.1' via the hosts file since pinging localhost resolves to an IPv6 localhost address even when IPv6 on virtual adapters show 'Media disconnected'.

Windows Server 2008 R2 x64 dies have a hosts file, but all entries in it are commented out including the 'localhost' entries there si also a not stating that "localhost name resolution is handled within DNS itself". There is a DNS server on the server but this could also mean that the local DNS client is handling localhost resolution and not the DNS server, this would seem more likely than the DNS server of the server handling localhost resolution for the localhost. Also, just checked and I never enabled IPv6 DNS.

Even though the command "ipconfig /all" shows no IPv6 enabled on any adpater, when I ping localhost I get an IPv6 response "::1:". This is a bit whacked! If it's enabled then it should show as enabled and if  it's not enabled then it shouldn't respond!

Well a bit more investigation revealed the two adapters I thought were virtual adpaters are:
   teredo tunneling pseudo-interface - used to tunnel IPv6 within IPv4
and
   Microsoft ISATAP Adapter - The Internet/Site Automatic Tunnel Addressing Protocol (ISATAP) connects IPv6 hosts/routers over IPv4 networks

IPv6 is are already disabled on all network adapters. The option to uninstall it is greyed out.

BOTTOM LINE - The fix was to connect to the MySQL server using "127.0.0.1" instead of "localhost".
Title: Re: HTTP Error 500.0 - Internal Server Error
Post by: datahell on January 27, 2010, 19:21:59
OK, use 127.0.0.1 then as the database host.
I believe that the problem will be solved if you add an entry in windows hosts file pointing localhost to 127.0.0.1

C:\Windows\System32\drivers\etc\hosts (open it as administrator)

127.0.0.1       localhost
::1             localhost

restart apache after changing that file.

Related article on elxis.org (https://www.elxis.org/guides/developers-guides/local-apache-and-virtual-hosts.html)