LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Error code 404 when accessing php and xml files using Ubuntu 11.10 (https://www.linuxquestions.org/questions/linux-newbie-8/error-code-404-when-accessing-php-and-xml-files-using-ubuntu-11-10-a-941405/)

oldFlurp 04-24-2012 12:45 AM

Error code 404 when accessing php and xml files using Ubuntu 11.10
 
I set up a copy of Ubuntu 11.10 a few weeks ago and have been setting it up as a server. I have almost everything working but I am not able to access either xml or php files from either SmartFoxServer or Unity. I have changed the ownership and groups in my www folder to www-data but that didn't get it done. I do have phpmyadmin working, can telnet to the ports that the applications use. If I try http://localhost I do get the Apache screen showing that is working. ANy ideas would be greatly appreciated!

Kustom42 04-25-2012 10:51 AM

Check your apache error log and see if it gives you an indication whey. Also verify your virtual hosts are displaying properly.

Code:

apachectl -t -D DUMP_VHOSTS

oldFlurp 04-25-2012 11:04 AM

I have included the actual error log info. I am not using this for any web hosting. We run it as a game server.

[Wed Apr 25 09:56:34 2012] [error] [client 192.168.10.103] File does not exist: /var/www/ws/bundles/requiredvalue
[Wed Apr 25 09:56:34 2012] [error] [client 192.168.10.103] File does not exist: /var/www/ws/reporting/exceptionall

I tried running the code you posted and got the reply:

No command 'apachctl' found, did you mean:
Command 'apachectl' from package 'apache2.2-common' (main)

I am fairly new to ubuntu/linux so I may be running it from an incorrect directory location.

Kustom42 04-25-2012 11:08 AM

Quote:

Originally Posted by oldFlurp (Post 4662820)
I have included the actual error log info. I am not using this for any web hosting. We run it as a game server.

[Wed Apr 25 09:56:34 2012] [error] [client 192.168.10.103] File does not exist: /var/www/ws/bundles/requiredvalue
[Wed Apr 25 09:56:34 2012] [error] [client 192.168.10.103] File does not exist: /var/www/ws/reporting/exceptionall

I tried running the code you posted and got the reply:

No command 'apachctl' found, did you mean:
Command 'apachectl' from package 'apache2.2-common' (main)

I am fairly new to ubuntu/linux so I may be running it from an incorrect directory location.


Well the No Command error is because you typo'ed the code I gave you lol. And what you should do now that you have your actual error is look and see if those files exist. Start from the bottom and work your way up, make sure to verify the correct capitalization as well as Linux is case sensitive.

Just do some ls -al's and see where the issue is.

oldFlurp 04-25-2012 11:11 AM

Sorry for the bonehead misspelling- here are the results:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server localhost (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default:1)
Syntax OK

Both of the files do exist and are owned by and in the www-data group.

Kustom42 04-25-2012 11:26 AM

Can you provide the output of the following commands:

Code:

stat /var/www/ws/bundles/requiredvalue
stat /var/www/ws/reporting/exceptionall


oldFlurp 04-25-2012 11:36 AM

stat /var/www/ws/reporting/exceptionall
stat: cannot stat `/var/www/ws/reporting/exceptionall': Not a directory

stat /var/www/ws/reporting
File: `/var/www/ws/reporting'
Size: 2923 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 2364896 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-04-22 14:14:17.202765541 -0600
Modify: 2011-12-19 19:55:23.000000000 -0700
Change: 2012-04-23 12:29:29.217288030 -0600

stat /var/www/ws/bundles/requiredvalue
stat: cannot stat `/var/www/ws/bundles/requiredvalue': Not a directory

stat /var/www/ws/bundles
File: `/var/www/ws/bundles'
Size: 6713 Blocks: 16 IO Block: 4096 regular file
Device: 801h/2049d Inode: 2364893 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 33/www-data) Gid: ( 33/www-data)
Access: 2012-04-23 15:08:26.349390042 -0600
Modify: 2012-04-22 15:03:11.977870420 -0600
Change: 2012-04-23 12:25:18.792436297 -0600

Both of these are php scripts. reporting is the name of the file and exceptionall is what it is trying to find. bundles is a php script and required values is what we are looking for on it. We use this on our production server and have no problems with it. I had copied over the entire www directory from our production server then changed the ownership and groups for all of them.

Kustom42 04-25-2012 11:56 AM

This does not make any sense to me. If bundles and reporting are your PHP scripts and the required value and exceptionall does not exist you are going to get a 404 error when requesting it. It's pretty straightforward. The only thing that would make sense is if you were doing some mod_rewrite rules on your production server that are not set up on this one. But if a file does not exist, as your stat command tells you, apache will give a 404 error code. If you are trying to pass the values of bundles and reporting to your PHP scripts you would do it with the syntax of bundles.php?variable=requiredvalue

oldFlurp 04-25-2012 12:22 PM

I have included a chunk of the php code so you would have a better idea of what we are doing. We have to download available asset bundles when the player is trying to log in and these are the scripts that handle the initial interface with the database. This has been my sticking point as it appears everything else is working as advertised. The guy who set up the last few of these servers got another job so I am trying to figure out how to make it work.

<?php
include( '../XXXXXXXX/mice.inc' );
if( isset( $_SERVER['PATH_INFO'] ) )
{
$result = array();
$path = $_SERVER['PATH_INFO'];
$path_params = explode("/", $path);

switch( $path_params[1] )
{
case 'requiredvalue':
$cxn = mysqli_connect( $host, $user, $password, $database );
$sql = "SELECT priorityId FROM game_asset_bundle_priority WHERE priorityLabel = 'Required' LIMIT 1";
$sqlResult = mysqli_query( $cxn, $sql );
if( $sqlResult != false )
{
$row = mysqli_fetch_assoc( $sqlResult );
$result = array( "required" => $row['priorityId'] );
}
else
{
array_push( $result, array( "status" => "error", "message" => "Unable to retrieve required priority value" ) );
}
break;

Kustom42 04-25-2012 02:06 PM

Your PHP code will make no difference if Apache is looking for the file /var/www/ws/bundles/requiredvalue and it does not exist. Apache handles the request first, locates the files, then processes your PHP and serves that code to your clients browser. So as I said in the last post you more than likely have mod_rewrite or mod_alias rules set in your Apache configuration allowing Apache to read that file. This is not going to do with anything related to PHP at this point.


All times are GMT -5. The time now is 11:56 PM.