Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5944

setting up phpLiteAdmin in WSL - ubuntu VS Code on Windows 11

$
0
0

I am working on replicating the online development environment of CS50 (GitHub Codespace) on my local Windows 11 machine.

I have installed "wsl" and "ubuntu" and I can run the ubuntu/bash/wsl terminal.

Also have VS Code installed.

After running some commands I got from chatGPT, I managed to clone my GitHub repository in the VS Code app.

One of my GitHub code projects is a web-app, which works great on CS50 Codespace online, of course. It relies on flask to bind htmls, app.py and an sqlite3 .db. but I also used the built in phpLiteAdmin functionality to view my .db files.

(I managed to get flask to work and my app launches locally in the browser just fine.)

Where I am stuck is getting phpLiteAdmin to work, so that I can easily view and edit my sqlite3 .db files (locally).

Here is what I have done:

  • downloaded phpLiteAdmin.config.php and phpLiteAdmin.php files from https://www.phpliteadmin.org/download/ to d:\programs-non-setup\pla\
  • Edited phpLiteAdmin.config.php to have $password = <my wsl-ubuntu password>;
  • downloaded php.exe (and other files) from https://www.php.net/downloads to d:\programs-non-setup\php\
  • Renamed php.ini-development to php.ini
  • added d:\programs-non-setup\php\ to my window's system environment path variable (though I doubt that matters, given I am using this virtual WSL thing).
  • installed the PHP Server extension for VS Code from brapifra and fixed its settings so that:
    • PHP Config Path points to D:\\programs-non-setup\\php\\php.ini
    • PHP Path points to d:\\programs-non-setup\\php\\php.exe
  • I also did Ctrl+, (Settings) in VS Code, found php validate executablePath under Remote [WSL:Ubuntu] and edited the settings.json file that came up thus:
    {    php.validate.executablePath: "d:\\programs-non-setup\\php\\php.exe",    phpserver.phpConfigPath: "D:\\programs-non-setup\\pla\\phpliteadmin.config.php" }
  • From VS Code terminal I ran sudo apt install php and also sudo apt install phpliteadmin seeing that both packages installed.

I then executed Ctrl-Shift-P in VS Code and type in PHP Server: Serve Project.

At this point I get "PHP not found" message in the bottom right corner of my VS code screen.

If from VS Code's terminal i run php -v, I get:PHP 8.1.2-1ubuntu2.17 (cli) (built: May 1 2024 10:10:07) (NTS)Copyright (c) The PHP GroupZend Engine v4.1.2, Copyright (c) Zend Technologieswith Zend OPcache v8.1.2-1ubuntu2.17, Copyright (c), by Zend TechnologiesBut if I run the same command from my windows terminal, I get:PHP 8.3.7 (cli) (built: May 8 2024 08:56:56) (ZTS Visual C++ 2019 x64)Copyright (c) The PHP GroupZend Engine v4.3.7, Copyright (c) Zend Technologies

That the two versions are different seems like it indicates a problem, but I don't know how to fix it.

I am really not sure what I am doing wrong at this point, but would love some help to resolve this problem of php not being found.What should I be/not be doing?

EDIT 1: As I was working in VS Code, all of a sudden this message popped up in the bottom right corner:Cannot validate since /home//d:\programs-non-setup\php\php.exe is not a valid php executable. Use the setting 'php.validate.executablePath' to configure the PHP executable.So, clearly, my paths to php.exe to my local drive (d:\) were not going to work as it only looks for files inside the ubuntu mounted "network" space. So I changed to this:

{"php.validate.executablePath": "php/php.exe","phpserver.phpConfigPath": "phpliteadmin.config.php"}

It did not solve the PHP not found problem

Edit 2:So, I corrected like this:

  • PHP Config Path points to nothing
  • PHP Path points to /usr/bin/php
And now indeed PHP Server does run. Though, it tries to open a url "localhost:3000" in the browser and returns a "404" page there. I also don't get the Right-click open with phpLiteAdmin option appear when I click on my .db file.

So, still stuck. From what I am reading, to set it up, I need a server with PHP 5.2.0 or higher installed and at least one PHP SQLite library extension enabled. The extensions that work with phpLiteAdmin are PDO, SQLite3.

I clearly have a good enough PHP (8.1.2 according to php -v). With PHP SQLite Library extension enabling, I think I am already good. If I run sudo apt-get install php-sqlite3 I get

php-sqlite3 is already the newest version (2:8.1+92ubuntu1).php-sqlite3 set to manually installed.0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Since I am happy to have any way to view and edit my .db files in a GUI, I just tried installing a VS Code extension called "Sqlite3-Editor from yy0931". Luckily, it gave me a way to interact with my .db files, so I am no longer in dire need of phpLiteAdmin, but it would be nice to find out what wasn't working on my end.


Viewing all articles
Browse latest Browse all 5944

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>