简体   繁体   中英

Running a PHP project on a remote webserver using Netbeans

I'm new to PHP, but as I understand, you can't run .php files locally, you need a server with php installed to do so. So I set Netbeans to run as "Remote Web Site", gave it the login credentials, and the path to put the files, all of which is does fine.

The problem is, when I try to run the project, it opens in chrome with a blank page, and there's nothing in the source code either. The URL for this is http://localhost/public_html/index.php , which you can set in the Project Url field of the project settings.

It seems to me that netbeans is trying to run from my local machine (hence localhost), even though it put all the files on my remote webserver. What URL should I be using if I want chrome to access the remote machine? I don't want to use my domain name obviously, so is there any way to run a php project like this?

Set the remote URL to the ip address of your remote server including any additional folders that are relative to your web root.

for example, a common web root on a linux server is /var/www/ . If you have placed your files in that folder on the server then you set the remote URL to http://the.ip.add.ress/ . However if you have placed your code inside a folder within that directory such as /var/www/myproject your url would be http://the.ip.add.ress/myproject/

Alternatively, it's perfectly normal to run a webserver on your local machine. If your on Windows, you can install the services your require such as apache/php/mysql and configure them manually. Or simply get a premade web server bundle like wamp, xampp, uniserver or one of the very many other ones out there you will find via google.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM