I downloaded the pdt plugin for eclipse for php development. I have mamp installed , with the web port set at 80. The name of my project is PHPTest.
I have one file in it ,called helloworld.php.
Hello world just echoes A text.
This project is located at
/Users/MYUSERNAME/EclipseProjects
When I run the project by right clicking on it, It shows this error in my browser :
Not Found
The requested URL /PHPTest/helloworld.php was not found on this
server.
So, why does this happen ? Is there some setting that I am missing?
or is the only way to get this running is to change the project's directory to the public html folder of mamp ?
This isn't related to xdebug support. Your HTTP server know nothing about your projects. you can fix this in three way:
Manually copy/paste project to your MAMP document root dir (default is /Applications/MAMP/httpdocs)
Change MAMP document root dir to workspace: /Users/MYUSERNAME/EclipseProjects (easies way)
Move your workspace to document root dir (/Applications/MAMP/httpdocs)
Related
a quick question about running PHP applications in Eclipse PDT. I have done a lot of searching but can not find what I am looking for.
I have XAMPP installed and am trying to run my PHP applications out of eclipse. The problem is I have my source files in a SUBFOLDER of the htdocs folder. So when I run, eclipse nagivates to:
http://localhost/index.php
But I need it to navigate to:
http://localhost/MyWebApps/index.php
Is there any way I can set the PHP server to always default to MyWebApps folder in eclipse? As MyWebApps is my eclipse workspace.
Thanks in advance!
Here 3 solutions:
First way, easy for one file. Project Explorer -> Right click on file -> Run As... -> Run Configurations. Configure similar to screenshot:
Then, click (V) arrow after run button in toolbar and choose configuration, "New configuration A" as in example.
Another better way: (root needed)
Add host "127.0.0.1 mywebaps.localhost" to /etc/hosts
Configure VirtualHost mywebaps.localhost in Apache, with document root point to your Workspace (files starting with "." should be blocked for this and nested directories, this is eclipse meta files)
Configure web server in eclipse to use mywebaps.localhost as host
name, then your file will be opened as
http://mywebaps.localhost/projectname/index.php
And finally, easy way: (root may be needed)
Leave your Workspace folder inaccessible by apache.
Create new php project, not in workspace but in apache document root
folder(should be writeable by user)
I am trying to set up the PHP debugger in Aptana Studio 3.3 to work with MAMP. I have a local project folder which is separate from the MAMP/htdocs folder; I 'deploy' to MAMP by copying the files from my local project folder to htdocs.
I've set up Aptana Studio->Editors->PHP->PHP Interpreters by adding a new interpreter of XDebug debugger type, with an executable path and PHP ini file pointing to the appropriate location and file for my MAMP install (/Applications/MAMP/bin/php5.4.4[/bin/php || /conf/php.ini]). The PHP debugger is set to XDebug. Aptana seemed to like that OK.
But, when I open a PHP file in my htdocs folder and try to set a breakpoint, I get the error "The file you are trying to place a breakpoint on is an external (non-workspace) file. Breakpoints are supported for PHP files that are located inside projects."
And, if I try to set a breakpoint and start the debugger in the same PHP file (but in my local project folder/workspace rather than htdocs), nothing happens. This makes sense as the file isn't under htdocs so MAMP doesn't know about it.
This would imply that my local project folder and my MAMP/htdocs project folder have to be one and the same in order to debug. I'd rather keep my project files separate from htdocs.
I would much appreciate your advice on 1) how to set up the PHP debugger in MAMP to get it to work at all (what am I doing wrong?), and 2) is it possible to set up the debugger to work so I can have my local project folder separate from the MAMP/htdocs folder?
There are other StackOverflow answers but they all describe how to set things up for earlier versions of Aptana Studio which didn't include the PHP debugger.
Thanks.
I'am trying to set up PHPStorm with xdebug. Everyting launches fine, but breakpoints just do not work and have "x" symbol on them.
I'm using openserver with PHP 5.4 and editing files directly on the local web server, so no file mapping is necessary.
I think, that my problem is that web server root is located below the project root directory (for security reasons) and PHPStorm does not that.
Project root: C:\OpenServer\domains\mysite
Web server root (configured in nginx): C:\OpenServer\domains\mysite\httpdocs
How do I tell PHPStorm, that the index.php that webserver runs is actually C:\OpenServer\domains\mysite\httpdocs\index.php, but not C:\OpenServer\domains\mysite\index.php?
You have to use path mapping.
You can find it in debug server configuration
Check out official docs and vids:
Help page
PHP Debugging webinar recording
JIT debugging
Smart step into
Simultaneous debug sessions
In my case, I tried these steps:
step 1: uncheck these two options at xdebug section
step 2: copy & paste the directory of your project at /xampp/htdocs/{your-project}
I installed wamp stack and then installed netbeans ide. The port number for apache is 100.
Created one PHP project at
C:\Users\aaa\Documents\NetBeansProjects\PhpProject2
and project URL http://localhost:100/PhpProject2/
When I click on run, I see the message "http://localhost:100/PhpProject2/index.php URL not found on the server".
What else I need to do to connect http://localhost:100/PhpProject2/index.php to C:\Users\aaa\Documents\NetBeansProjects\PhpProject2?
Please help.
You need to configure Apache's webroot to be C:\Users\aaa\Documents\NetBeansProjects (search for DocumentRoot in the file httpd.conf).
Or you can move/copy your files to the existing webroot, which may be something like c:\wwwroot.
Apache doesn't just magically know where you put your website files, and setting the URL inside NetBeans doesn't actually configure the webserver (I think it's just so that auto-generated links are right).
If you go to http://localhost:100/, what do you see? What is your web root? The folder needs to be in your web root, and I would be surprised if it is C:\Users\aaa\Documents\
I did a Google search for "wamp stack" and found a product by Bitnami... if this is the one you are using, the default web root is C:\Program Files\BitNami WAMP Stack\apache2\htdocs\. If that is indeed the case, then you'd need to move the NetBeansProjects folder to there. (source: http://bitnami.org/files/stacks/wampstack/5.3.6-0/wampstack.pdf page 7)
You need to look into aliasing. That will let you more or less assign directories in the url path to arbitrary directories on your file system.
You have to move your files to your root folder of the Apache installation (htdocs). You should refer to your WAMP installation for where that is located. Personally, I like to use XXAMP for installation.
Netbeans is just an IDE, it doesn't serve the files.
I'm using Netbeans to develop an HTML/PHP site and I have the Run Configuration set as follows:
Project URL: http://localhost/JEB
Project Folder: C:\Documents and Settings\John\My Documents\NetBeansProjects\JEB
Source Folder: C:\Documents and Settings\John\My Documents\NetBeansProjects\JEB
Web Root:
The "Copy files from Sources Folder to another location" option is checked and the Copy to Folder location is: C:\xampp\htdocs\JEB.
The problem is, when I edit files in the Project Folder, and then click Run, I'm expecting them to copy to the web location (C:\xampp\htdocs\JEB) and then run in the browser. But that's not happening. The files are not getting copied over so I'm seeing the old versions of the files that were previously in the C:\xampp\htdocs\JEB folder. (I had this working once before, I thought.)
Am I misunderstanding how this works? I thought you were supposed to edit the files in the Source folder, and they would automatically be copied to my web server folder when I ran the project locally. I've checked the NetBeans forums and found one other person with this problem, but no working solution. I was having this problem with Netbeans 6.5.1 so I upgraded to 6.7.1 and still no luck.
Thanks.
I had this problem too and it seemed to be a bug in NetBeans. I was using Ubuntu Linux 9.04 with NetBeans 6.5 and 6.7.1.
When it happened to me, I would delete all of the files in the destination location and then run the project again. When NetBeans sees that there are no files there, it copied the latest version over. From then on it usually worked correctly (i.e. automatically copying files from the source to destination folder every time I ran the project). Sometimes I also had to restart NetBeans for this to work correctly.
Not a solution, but work around.
Create a XAMPP Alias to the directory where your files are located, see: Make XAMPP/Apache serve file outside of htdocs