• PHP Help
  • Eclipse PHP IDE. Opening Notepad on Run

Eclipse IDE for PHP Developers (includes Incubating components)
Version: 2023-06 (4.28.0)
Build id: 20230608-1333
OS: Windows 11, v.10.0, x86_64 / win32
Java vendor: Eclipse Adoptium
Java runtime version: 17.0.7+7
Java version: 17.0.7

Hello all
Lost my hard drive and with it alll of my apps so having to rebuild.
I have downloaded Eclipse PHP IDE (see above.
It has installed ok and I can load my web projects from my workspace into the IDE no problem.
When I try to Run them I get a pop up Notepad session saying "Not a valid file name".
Has anyone got any idea why it is doing this and what I need to do to correct it?

Thanks

Ray Pooley

    I don't mean to be rude, but you're using Eclipse for php? In 2023? Skip it and use VSCode (free) or PHPStorm (not free).

    Beyond that, it sounds like maybe you don't have a local server running - it's been a long time since I tried eclipse, but I think I remember you needed to set up a local server for it. Please don't hold me to that as I could very well be wrong.

    maxxd
    Each to his own.
    The built in server is started and running.
    PHP Built-in Server at localhost [Started, synchronised]

      Does the error say what is not a valid file name?

      (I, too, have not touched Eclipse in a long time, and don't recall if I ever really used it or not...but poking around the net a bit, I found a few cases where Eclipse apparently didn't like file names with certain characters in them. 🤷)

      Is your local server set up to serve php files and index as default? It sounds like it may be an apache or nginx config issue (not sure which server you're using locally).

        12 days later

        maxxd
        I'm back.
        I took on board what you said about VS Code and have spent some time working with it.
        Have you actually used it? Including the built in server for PHP?
        I can't get the BIS to recognise the sqlsvr driver.
        I have all the necessary MSSQL extensions installed and the editor intellisense knows the
        sqlsvr objects and can display their properties and methodsin the editor.
        But the BIS consitently fails to see the sqlsvr objects at run time.
        The project is in it's own workspace and runs fine under IIS.
        All database transactions work perfectly.
        So it's not a problem with the site.
        I can also run queries on the data server in the VS Code IDE.
        I am missing something in the VS Code environment.
        Any idea what that might be?

        Thanks

        Ray

          I use VSCode daily on several different machines - to serve the site(s) locally I use either docker or php's built-in server (php -s localhost:8001) (either is started separately from a terminal). Granted, I use MySQL with Apache on linux-based environments (again via docker, through WSL2 on Windows, or OSX on Mac) so maybe there's something weird there. I do remember in eclipse you had to do a whole project location setup, but it's been long enough that I can't remember if that would then simulate a server or not. There's not - that I know of - a similar paradigm in VSCode; you open a directory and that becomes the working directory. Serving the site is a separate thing.

          maxxd
          It shouldn't really make a difference whether it's MSSQL or MySQL really.
          The problem is
          Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect()
          Can't see the function.

          " (either is started separately from a terminal)."
          This tweaked my curiosity.
          I assumed that the server is started by default when I launch VSCode IDE.
          What is this server starting process?

          Cheers

          No, VSCode doesn't actually start a local server. You'll need to open a terminal window (again, I use Ubuntu via WSL2 - I assume you can use powershell or cmd on Windows base) and run php -S localhost:8001. You can also use the terminal built into VSCode to do this, I think. This will start PHP's built-in dev server, which you'll be able to hit in your browser at http://localhost:8001.

          As to the function not found, are you certain you've got the sqlsrv extension installed? Check the output of phpinfo() to make sure it's actually there. You may be able to use PDO intead, but I'm not familiar enough with sqlsrv to speak to that with any level of certainty.

          Weedpacket Yes. As I said the sqlsssrv objects are visible to intellisense and I can interrogate the sql database in vscode.

          maxxd
          I will explore that but if it doesn't work I will just use VSCode as an editor. It's useful for that at least,
          I would add a screen dump to show the enabled extensions but the Add Image function doesn;t work,
          It just puts link ![](https://) in the comment.
          I have no idea what I'm supposed to do with that.
          Not something I have seen befiore.
          It's certainly unconventional

            Weedpacket
            Understand that the project works fine under IIS.
            Everything about it. The pages render properly. Navigation works and all database transactions.
            Obviously PHP knows about the drivers. Otherwise there would be no communication with the database.
            This isn't about the project not working as it should do.
            It's a question of why it won't run in VSCode using the built iin server for PHP.
            It's VSCode that can't see the drivers.

              But VSCode isn't running your code. PHP is. That's why you have PHP's built-in server (it's not VSCode that has the built-in server, it's PHP). Seems that different configurations are being used in the two cases. Check phpinfo for both and see what they report for "Loaded Configuration File". (Doing this on the internal server is just a matter of having a file phpinfo.php containing <?php phpinfo(); ?> and then requesting that file.) Check, too, for a SQL Server specific section. Might as well also look at the extension_dir and include_path settings while you're there, but that information comes from php.ini so if they're reading the same file those would be the same also.

              Weedpacket
              How do you imagine it would run under IIS if PHP wasn't correctly configured?
              It wouldn't. I know this because it didn't run until I configured PHP properly.
              There is only one PHP installation folder on the machine. PHP 7.4.33 and compatible drivers.
              extension=php_sqlsrv_74_nts_x64.dll
              extension=php_pdo_sqlsrv_74_nts_x64.dll
              There is only one PHP.ini file in the root of the PHP installation folder
              Both IIS and VS Code are pointing to the same PHP installation folder.
              Both IIS and VS Code are pointing to the same workspace folder where the project files are located.
              Both IIS and VS Code are pointing to and connected to the same SQL Server instance and the same database.
              Using the same authentication method and credentials.
              The site runs fine under IIS on localhost.

                The whole point here is that VSCode is just an editor. Nothing more. It won't "run" your site, and it doesn't care where on your system PHP is installed beyond being able to provide hints and definitions as you code. And unless you've installed an SQL plugin, VSCode doesn't care a thing about your database.

                As to the 'Add Image' function, I'm not really sure what that refers to. However, the ![](https://) is pretty standard Markdown, which has been around since about 2004. In fact, this board uses it. Click the link button in the editor and you'll see almost exactly what you posted (the exclamation mark lets the interpreter know you mean an image, not a hyperlink).

                If your site is working on the same machine you're developing on, then it sounds like the confusion has to do with what you expect VSCode to do. If it's working on a different machine, then you need to heed Weedpacket's advice and check the setup on your local machine - something is different between the two systems.

                It sounds like you've gotten used to doing things a specific way, which is very understandable. In the meantime, the world has moved on and you're just now getting shoved into it. I've been at this for ~25 years so I get it but I can tell you it's much better now then it was back then.

                maxxd
                Maybe I am expecting too much from VS Code.
                VS Code is a good PHP editor. No problem with that.
                But it is called an IDE and an IDE is more than just an editor.
                It has run and debug facilities and they do launch the site.
                Bottom line is it can't see the drivers whereas the IIS webserver can.
                It's the runtime and debug that's not working.
                It's not a show stopper. I will still use the editor and run the projects under IIS.
                It would be nice to inderstand why it doesn't work.

                Typical Add Image function, at least in my websites, allows you to Browse local images and upload them.
                It uses a an HTML input type="file" name="filename" tag. This renders a Browse button on the form.
                But I have never seen this ![](https://)
                What am I supposed to do with that link when presented with it?
                What would I have to do with that to link it to and upload a local file?

                I am a .Net developer. Every version from the first in 2000 to the latest 2022 version.
                Been using SQL Server and IIS just as long. Began developing web applications in 1998.
                HTML/Javascript/Perl/CGI first off and the Classic ASP. Picked up .Net in 2000.
                So I am the same vintage as you.