mevdschee / php-crud-admin

A database admin interface for MySQL, PostgreSQL or SQL Server in a single file PHP script.
MIT License
58 stars 21 forks source link

Rewrite required #7

Open Mte90 opened 2 years ago

Mte90 commented 2 years ago

Looking at what is printed the urls in the admin ui:

https://github.com/mevdschee/php-crud-admin/blob/60b6d05b914407098de25d77474151aa1db061b1/templates/column/list.html#L2

But the readme doesn't mention that is required a URL rewriting for the file and that will ignore the folder where the project is.

Example:

http://localhost/php-crud-admin/admin.php/table/list

Generate:

error
code:

1000
message:

Route '/table/list' not found

But http://localhost/php-crud-admin/admin.php/ I get the list of tables but the links are http://localhost/admin/column/mytable/list.

mevdschee commented 2 years ago

A rewrite should not be needed. The {base} is not correctly detected.

mevdschee commented 2 years ago

@Mte90 Can you tell me the webserver you are using? Is it Apache, PHP internal server or Nginx?

mevdschee commented 2 years ago

For PHP's internal server I added a file start.sh containing a command to start the application:

php -S localhost:8000 admin.php

I hope this helps.

Mte90 commented 2 years ago

On apache :-)

I saw that bash script few minutes ago :-)

mevdschee commented 2 years ago

Thank you. I'll test the {base} detection on Apache and get back to you

mevdschee commented 2 years ago

It is fixed in v2.0.2. Does it work for you?

Mte90 commented 2 years ago

[Fri Oct 07 14:39:05.575271 2022] [proxy_fcgi:error] [pid 81210] [client 127.0.0.1:53206] AH01071: Got error 'PHP message: PHP Warning: Undefined array key "tables" in /home/www/php-crud-admin/admin.php on line 13121PHP message: PHP Fatal error: Uncaught TypeError: Tqdev\\PhpCrudAdmin\\Column\\DefinitionService::makeNamed(): Argument #1 ($array) must be of type array, null given, called in /home/www/php-crud-admin/admin.php on line 13121 and defined in /home/www/php-crud-admin/admin.php:13128\nStack trace:\n#0 /home/www/php-crud-admin/admin.php(13121): Tqdev\\PhpCrudAdmin\\Column\\DefinitionService->makeNamed()\n#1 /home/www/php-crud-admin/admin.php(13087): Tqdev\\PhpCrudAdmin\\Column\\DefinitionService->optimizeDatabase()\n#2 /home/www/php-crud-admin/admin.php(14036): Tqdev\\PhpCrudAdmin\\Column\\DefinitionService->__construct()\n#3 /home/www/php-crud-admin/admin.php(14212): Tqdev\\PhpCrudAdmin\\Admin->__construct()\n#4 {main}\n thrown in /home/www/php-crud-admin/admin.php on line 13128'

I get this.