Menu

How do you get php/apache to run?

2006-04-20
2013-04-30
  • Nobody/Anonymous

    I installed EE-PHP distro and it loads fine. I coded a one-line PHP file (phpinfo();) in a project/file.php. How do I run this thing from within EE? I already have apache2 and php installed. I don't know if EE comes with it's own webserver. When I click 'run' I get a screen for 'perspectives'. Obviously I'm new to Eclipse, but I've used other IDEs before. What is the trick here to run php inside EE.... or can you?

    al

     
    • Philippe Ombredanne

      To get started with PHPEclipse, you need to set some preferences to tell the plugin where are PHP, Apache and MySQL installed. Note that it is sometimes easier to use the XAMPP control panel for those operations. Go to the menu Window/Preferences then select in the left pane tree :
      PHPEclipse Web Development/PHP External tools to set the PHP executable location
      PHPEclipse Web Development/PHP External tools/Apache to configure the Apache executable location
      PHPEclipse Web Development/PHP External tools/MySQL to configure the MySQL executable location

      PHPEclipse Web Development/PHP External tools/XAMPP to configure the XAMPP control panel executable location (if you are using the recommended XAMPP)

      PHPEclipse Web Development/PHP/Help to set the location for Windows help for PHP. (That help file comes with PHP on Windows and the XAMPP PHP/Apache distribution )

      PHPEclipse Web Development/Project Defaults to set the location for your web documnest and the default URL for all projects. You can override that prefernce for each project by chaning the project specific properties. Once preferences are set, got to the menu Window/Open Perspective and select the PHP Prespective.
      Then create a new PHP Project with the menu File/New ../PHP Project and create a PHP file in that project using the menu File/New../PHP File. Name that file index.php
      Finally, edit the file with the following:

      <?php?>
      Hello PHP world!
      <? phpinfo(); ?>

      Note that you may need to edit the Apache configuration under apache/conf/httpd.conf to have an alias pointing to your Eclipse workspace. That would tell Apache to look in that directory also for web files (Note the use of forward slashes on Windows too):

      Alias /myphp "C:/Documents and Settings/Administrator/workspace"
      <Directory "C:/Documents and Settings/Administrator/workspace" >
          Options Indexes MultiViews ExecCGI
          DirectoryIndex index.php
          Order allow,deny
          Allow from all
      </Directory>

      The URL for test with that configutaion is then : http://localhost/myphp// because we configured an alias in Apache called myphp.

      I hope that helps!

       
      • Nobody/Anonymous

        I am an experienced Java developr but new to PHP and so I downloaded the latest version of Easyeclipse-lamp version. I then created a PHP project and then Hello.php file. I then tried to execute it, I get an error that says "application failed to start because intl3_svn.dll was not found. Reinstalling the application may fix this problem". One of the reason I went to Easyeclipse-lamp version is that I don't have to muck around with setup. I should be able to write a php script and run it. Granted that I need to point to the PHP parser.
        First, I went to run-time environment and then set the parse to point to php.exe in my Xampp directory. Same error.
        Next, I went to the eclipse win-pref-Phpeclipse Web option and then PHP External tools and set the XAMPP, MySQL, Apache and Run PHP command to point to ~xampp\php\php.exe and Parser command to same as above with -l -f {0} flags. I also played with using php-win.exe.

        So my question is what am not doing right or missing here?
        This should have been a no brainer and here I am spending hours mucking around with configuration. Any pointer would be apprecaited. Thanks in advance.

         
    • Nobody/Anonymous

      I should have mentioned earlier that I'm running Debian Sid (unstable) with apache2 and mysql 5.0.18

      You say:
      PHPEclipse Web Development/PHP External tools to set the PHP executable location

      But I don't have a php executeable. It is a 'mod' of apache2. I did set the the apache to /usr/sbin/apache2.

      Right now I don't need mysql for this test.

      What is XAMPP and why do I care?

      Appache2 does not really use httpd.conf. I'm not sure WHAT it uses to be honest as I've not had to mess with it since I installed the package (one of the beauties of Debian as the apt-get system does such a good job of setting things up for you... mysql, php, apache... all worked out of the box... not like EasyEclipse :-( 

      Do i need to reinstall php so I can get an executable?

      Thanks,

      al

       
      • Philippe Ombredanne

        al:
        I took avdantage of your question to reply witha fairly generic post to to use in the future as getting started documention.
        >But I don't have a php executeable.
        >It is a 'mod' of apache2. I did set the the >apache to /usr/sbin/apache2.

        >Right now I don't need mysql for this test.
        Np, just ignore it

        >What is XAMPP and why do I care?
        If you have apapche already you do not care. It is a distro of apache/mysql/php and a few more. quite handy when you do not have it. PHPEclipse suuport them is their UI. see http://sf.net/projects/xampp

        >Appache2 does not really use httpd.conf.
        I think it still does. But I could not know for sure on your machine, if you have a modded apache. Check in /usr/sbin2/apache2/conf

        >Do i need to reinstall php so I can get
        >an executable?
        It is not indispensable, nut would be better. You need to make sure that the pref in PHPEclipse Web Development/Projects default are set right. And you would need to haev some alias set for Apache, unless your create a workspace directly somewhere in htdocs, I think.
        Without a php.exe you will not get the ability to launch and debug PHP code. Everything will flow only through the apache module.

        >one of the beauties of Debian as the apt-get
        >system does such a good job of setting things up
        >for you... mysql, php, apache... all worked out >of the box... not like EasyEclipse :-(
        Sorry, but this still a beta, and we are trying hard to get things smoother, like the pre-configuration of the plugins, so they could 'discover' important run time info.

         
        • Philippe Ombredanne

          I forgot to point you to more info about phpeclipse :
          There is a collection of links here:
          http://easyeclipse.org/site/plugins/phpeclipse.html

          Especially the wiki link may be of some help.
          But you can post here too for support.

           
    • Pat Willard

      Pat Willard - 2006-05-13

      A very simple method to do this is to use the project properties.  Create a PHP project in Eclipse.  Then open Project->Properties.  From the list on the left of the dialog choose "PHP Project Settings".  Click the "Use project settings" radio button.  In the input field labeled "DocumentRoot" enter the fully qualified path the document root (for example: C:\Apache2\htdocs).  If, like me, you have multiple development projects on your web server, create another folder under htdocs, and set the fully-qualified path to that subdirectory in the "DocumentRoot" directory.  For example, my Eclipse project is named "phptestproject" and the path is "C:\Apache2\htdocs\phptestproject", making it easy to stay organized.

      By doing so, all the files and folders that you create in the Eclipse IDE are created in the Apache htdocs directory, and work as normal, without having to modify the Apache config file.

       
      • Francois Granade

        Thanks patwillard. This is clearly the best way to start with PHP Eclipse. It works nicely with CVS also, so you can get some miles with it. I'm adding a link from the website to your post.

        Now, to get more from PHPEclipse (in particular, getting the debugger to work) more steps are required, I think that pombredanne's explainations are a good start. In particular, I believe that the links on the PHPEclipse plugin page (http://easyeclipse.org/site/plugins/phpeclipse.html#links) are a good start. Don't hesitate to ask if it's not enough.

         
      • Nobody/Anonymous

        I was just wondering if there were any plans on incorporating Flex Support.  I'd be happy to provide both the MXML and Action Script 3 (as well as 2 if needed or wanted).  Any thoughts on this?  You can reply at kevin@xkspace.com

        Thanks.  Oh and thanks for the rockin apps.  =D

         
  • Anonymous

    Anonymous - 2011-05-12

    Easy enough. Also…

    In /private/etc/hosts:

    127.0.0.1 localhost phptest.dev
    

    In /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf:

    <VirtualHost *:80 >
        ServerAdmin phptest.dev@[your domain].com
        DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/phptest/"
        ServerName phptest
        ServerAlias *.phptest.dev phptest.dev
        ErrorLog "/Applications/XAMPP/xamppfiles/htdocs/phptest/error.log"
        CustomLog "/Applications/XAMPP/xamppfiles/htdocs/phptest/custom.log" common
    </VirtualHost>
    

    You may have to restart Apache XAMPP

     

Log in to post a comment.