Skip to content

Fix URL passed to static.php in PHP in-development server #13361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2018
Merged

Conversation

nieltg
Copy link
Member

@nieltg nieltg commented Jan 25, 2018

Unresolved static assets are generated by passing some part of URL as resource= parameter to pub/static.php. But PHP in-development server's router, router.php, wrongly passes the parameter.

Instead of frontend/Magento/luma/en_US/images/logo.svg, PHP in-development server's router uses static/frontend/Magento/luma/en_US/images/logo.svg for resource= parameter.

Because of that, resources can't be resolved when Magento runs on PHP in-development server.

Description

This pull request removes static/ string from the resource= parameter, so static.php can generate the specified resource correctly.

This pull request also changes command to start PHP in-development server in the documentation. The previous command in the documentation is:

$ php -S 127.0.0.1:8082 -t ./pub/ ./phpserver/router.php

which results an error because PHP is unable to find router.php.

PHP 7.1.13 Development Server started at Thu Jan 25 19:50:01 2018
Listening on http://127.0.0.1:8082
Document root is /mnt/d/Projects/Magento/magento2/pub
Press Ctrl-C to quit.
[Thu Jan 25 19:50:07 2018] PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Thu Jan 25 19:50:07 2018] PHP Fatal error:  Unknown: Failed opening required '/mnt/d/Projects/Magento/magento2/pub/./phpserver/router.php' (include_path='.:') in Unknown on line 0

Manual testing scenarios

  1. Get a freshly cloned Magento repository.
  2. Run composer install.
  3. Setup Magento using php bin/magento setup:install as specified in the documentation.
  4. Start PHP in-development server using php -S 127.0.0.1:8082 -t ./pub/ ../phpserver/router.php.

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jan 25, 2018

CLA assistant check
All committers have signed the CLA.

@miguelbalparda
Copy link
Contributor

This is quite interesting, I'll give it a try tomorrow. Have you seen any reported bugs related to this?

@nieltg
Copy link
Member Author

nieltg commented Jan 25, 2018

Thank you @miguelbalparda!
Sorry, I haven't checked any reported bugs yet about this problem.

I've just been trying to run Magento on PHP in-development server and found some issues to be fixed. 😁

@miguelbalparda miguelbalparda self-assigned this Jan 31, 2018
@miguelbalparda
Copy link
Contributor

miguelbalparda commented Jan 31, 2018

pub and phpserver folders are at the same level, why do you use 2 different paths in php -S 127.0.0.1:8082 -t ./pub/ ../phpserver/router.php?

@miguelbalparda
Copy link
Contributor

miguelbalparda commented Jan 31, 2018

I see what you mean now, my bad.

@miguelbalparda
Copy link
Contributor

This seems to be present in 2.2 and 2.1 but removed in f05a32f
Do you remember the reason for the removal @aredridel?

@magento-engcom-team
Copy link
Contributor

@nieltg thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@nieltg
Copy link
Member Author

nieltg commented Feb 13, 2018

@magento-engcom-team
Woah, really? Thank you very much.

@aredridel
Copy link
Contributor

@miguelbalparda Removal of what?

@miguelbalparda
Copy link
Contributor

Isn't this you @aredridel?

@magento-engcom-team magento-engcom-team merged commit 19119c1 into magento:2.3-develop Feb 21, 2018
@nieltg nieltg deleted the pull-1 branch June 14, 2018 07:41
@nieltg nieltg restored the pull-1 branch June 14, 2018 07:41
@nieltg nieltg deleted the pull-1 branch June 14, 2018 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants