LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-24-2012, 12:45 AM   #1
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Rep: Reputation: Disabled
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!
 
Old 04-25-2012, 10:51 AM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
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
 
Old 04-25-2012, 11:04 AM   #3
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
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.
 
Old 04-25-2012, 11:08 AM   #4
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Quote:
Originally Posted by oldFlurp View Post
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.
 
Old 04-25-2012, 11:11 AM   #5
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
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.
 
Old 04-25-2012, 11:26 AM   #6
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Can you provide the output of the following commands:

Code:
stat /var/www/ws/bundles/requiredvalue
stat /var/www/ws/reporting/exceptionall
 
Old 04-25-2012, 11:36 AM   #7
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
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.
 
Old 04-25-2012, 11:56 AM   #8
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
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
 
Old 04-25-2012, 12:22 PM   #9
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
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;
 
Old 04-25-2012, 02:06 PM   #10
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading XML files with php boloo Programming 2 02-11-2012 09:11 AM
[SOLVED] id3-0.78 homepage for source code 404 error - slackbuild fails BoydRice Slackware 3 12-19-2010 02:07 AM
SVN Bazaar error: Unable to handle http code 401: expected 200 or 404 for full respon vikramtheone Linux - Newbie 0 07-02-2010 08:10 AM
404 error Accessing citicards.com using firefox as of late? NightSky Slackware 7 05-21-2008 05:45 PM
php: writting files code error PB0711 Programming 3 01-29-2007 10:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration