NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

PHP file not running in Netbeans? (possible configuration issue)

 
Post new topic   Reply to topic    NetBeans Forums -> PHP Users
View previous topic :: View next topic  
Author Message
OM99



Joined: 04 Nov 2016
Posts: 2

PostPosted: Fri Nov 04, 2016 8:10 pm    Post subject: PHP file not running in Netbeans? (possible configuration issue) Reply with quote

I'm trying to run a PHP file in Netbeans. The project is a simple PHP project that was created from source files taken from a hosted webserver that I use. An SFTP connection is used. When I run the project, I am met with the following error;

Not Found

The requested URL /Connect.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.




Code:
<!DOCTYPE html>

<html>
      <head>
      <title>Test Code</title>
      </head>
<?php
      $servername = “example.example.com”;
      $username = “admin_user”;
      $password = “1111222233334444”;
      $dbname = “test_exampleDB”;

// Create connection
   $conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
  if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
  echo "Connected successfully";
?>


Project configuration:

Run as: Remote Website (FTP, SFTP)
Project URL: http://example.net
Index File: Connect.php
Arguments: None
Remote Connection: SFTP (setup during the creation of project)
Upload Directory: sftp://example.example.com/home/user/public_html/Datbase
[b]Upload Files:
On Save

Should I be using a different configuration? Should the servername be an IP or localhost instead?

The file upload to the server when I press save, but the project is met with the error when I run it in the browser.

Any help would be much appreciated!
Back to top
paolosca



Joined: 09 Sep 2010
Posts: 515

PostPosted: Sat Nov 05, 2016 1:20 pm    Post subject: PHP file not running in Netbeans? (possible configuration issue) Reply with quote

Hi,

The error simply means that the URL requested by the browser (/Connect.php) couldn't be found in the document root of the server (/).


You should check the apache configuration for the site to make sure the DocumentRoot parameter corresponds to the path you are using to upload the files (/home/user/public_html/Datbase).


If your DocumentRoot is /home/user/public_html you should be able to access the script with the URL http://example.net/Datbase/Connect.php


Regards,


Paolo




On Sat, Nov 5, 2016 at 4:10 AM, OM99 <address-removed ([email]address-removed[/email])> wrote:
Quote:
I'm trying to run a PHP file in Netbeans. The project is a simple PHP project that was created from source files taken from a hosted webserver that I use. An SFTP connection is used. When I run the project, I am met with the following error;

Not Found

The requested URL /Connect.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.




Code:
<!DOCTYPE html>

<html>
      <head>
      <title>Test Code</title>
      </head>
<?php
      $servername = “example.example.com”;
      $username = “admin_user”;
      $password = “1111222233334444”;
      $dbname = “test_exampleDB”;

// Create connection
   $conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
  if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
  echo "Connected successfully";
?>




Project configuration:

Run as: Remote Website (FTP, SFTP)
Project URL: http://example.net
Index File: Connect.php
Arguments: None
Remote Connection: SFTP (setup during the creation of project)
Upload Directory: sftp://example.example.com/home/user/public_html/Datbase
[b]Upload Files: On Save

Should I be using a different configuration? Should the servername be an IP or localhost instead?

The file upload to the server when I press save, but the project is met with the error when I run it in the browser.

Any help would be much appreciated!




Back to top
OM99



Joined: 04 Nov 2016
Posts: 2

PostPosted: Sat Nov 05, 2016 8:50 pm    Post subject: Re: PHP file not running in Netbeans? (possible configuration issue) Reply with quote

paolosca wrote:
Hi,

The error simply means that the URL requested by the browser (/Connect.php) couldn't be found in the document root of the server (/).


You should check the apache configuration for the site to make sure the DocumentRoot parameter corresponds to the path you are using to upload the files (/home/user/public_html/Datbase).


If your DocumentRoot is /home/user/public_html you should be able to access the script with the URL http://example.net/Datbase/Connect.php


Regards,


Paolo




On Sat, Nov 5, 2016 at 4:10 AM, OM99 <address-removed ([email]address-removed[/email])> wrote:
Quote:
I'm trying to run a PHP file in Netbeans. The project is a simple PHP project that was created from source files taken from a hosted webserver that I use. An SFTP connection is used. When I run the project, I am met with the following error;

Not Found

The requested URL /Connect.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.




Code:
<!DOCTYPE html>

<html>
      <head>
      <title>Test Code</title>
      </head>
<?php
      $servername = “example.example.com”;
      $username = “admin_user”;
      $password = “1111222233334444”;
      $dbname = “test_exampleDB”;

// Create connection
   $conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
  if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
  echo "Connected successfully";
?>




Project configuration:

Run as: Remote Website (FTP, SFTP)
Project URL: http://example.net
Index File: Connect.php
Arguments: None
Remote Connection: SFTP (setup during the creation of project)
Upload Directory: sftp://example.example.com/home/user/public_html/Datbase
[b]Upload Files: On Save

Should I be using a different configuration? Should the servername be an IP or localhost instead?

The file upload to the server when I press save, but the project is met with the error when I run it in the browser.

Any help would be much appreciated!






Hi Paolo,

I was able to figure it out. Your answer is correct. Thank you for replying.

Regards,

OM
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> PHP Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo