How to make wamp/apache to use htaccess? - php

I forked a working php project from github to create some json files to it, but i can't test it because js and css won't load, i have never used php in my life, so i followed what the install guide said.
composer install
edit .env
php artisan migrate:refresh --seed -vvv
testing vendor/bin/phpunit
This was the guide.
What i did step by step.
installed wamp64
cloned the repo into www
installed composer
ran the composer install command on the right folder
created virtual host for the folder with wamps add a virtual host option, named targygraf.test
created a db with phpmyadmin and set pw
edited the .env file to targygraf.test and to use the db and pw i created
ran php artisan migrate:refresh --seed -vvv
It did what it should i suppose because the database built up, and i was able to access the page with the server.php file, except that css and js didn't load.
Checked with the inspector and they were linked like this http://targygraf.test/server.php/assets/js/targygraf.js, i have visited a TON of forums about the problem, every single one said that i have to turn rewite_module on and set AlloweOverride to All so i did. But still nothing, and as i said earlier, the app was working on another pc and is working online right now, so i'm guessing i did something wrong.
This is the original github link: https://github.com/valentinxxx/targygraf
Edit1: corrected step 5 and 7, added original link

this is a Laravel project, so if it's your first time with php, it becomes a little more complicated.
In a few words:
laravel uses the routes at /routes/web.php, so: it's using: Route::get('/', 'HomeController#getIndex')->name('index'); for the home
/app/Http/Controllers/HomeController#getIndex calls layouts.index view .
this view uses /resources/views/template.blade.php. You can check your css and js there.
You can replace {{ url('assets/css/style.css') }} for '/assets/css/style.css' and see if this way the browser finds the file.
Anyway, there are other possible problems, keep in mind your Apache server should open "[project_folder]/public"

What I did to resolve this problem
reinstalled wamp and composer
forked a clean repo of the project
ran composer install
set phpmyadmin pw
created mysql table
created virtual host, this time pointing to [project_folder]\public instead of [project_folder] (This is the important part as with pointing to [project folder] the page will load but without css, but with the address pointing to [project_folder]\public the page works perfectly)
ran php artisan migrate:refresh --seed -vvv

Related

Laravel and Lighthouse, it always read the dafault schema

I'm following the tutorial on Lighthouse website for the master version (4.1).
https://lighthouse-php.com/4.1/getting-started/tutorial.html#installation
I make a fresh intallation of Laravel 5.8, then I execute the commands written in the tutorial (beside npm install)
composer require nuwave/lighthouse mll-lab/laravel-graphql-playground
php artisan vendor:publish --provider="Nuwave\Lighthouse\LighthouseServiceProvider"
php artisan vendor:publish --provider="MLL\GraphQLPlayground\GraphQLPlaygroundServiceProvider"
after that a /graphql/schema.graphql file is created (under the project root, not under the routes folder as happened with the previous versions).
Now I populate the DB with some data and then I copy/paste the schema from the tutorial page to the published schema, I start the server, then I access playground which shows the correct url where to send the requests http://127.0.0.1:8000/graphql.
Clicking on the Schema tab I always see the default schema and not the one published in /graphql/schema.graphql, and of course the queries for the resources different from the users fails with an error like Cannot query field "posts" on type "Query".. I've already tried restarting the server and refreshing the Playground page.
Into the config/lighthouse.php file the schema is registered to the path base_path('graphql/schema.graphql') which looks correct.
Why Playground always shows the default schema and not the published and edited one?
I'm using PHP 7.2.14 and Lighthouse requires PHP>7.1
I thought the problem is related to the caching. I tried to add LIGHTHOUSE_CACHE_ENABLE=false to the laravel .env file and restart the server then refresh the playground page. I recheck the schema and it is updated.
I hope it's useful.

Windows>XAMPP>Magento 2>Chrome.... Broken out of Box

This is the admin panel of my newly installed, unaltered install of Magento 2.2.5 in XAMPP 7.0.30 / PHP 7.0.30:
I am brand new to this, but I have done my best to find an answer or even just a solution on my own. I need help.
I do not see any folder with the path localhost/pub/static/version1532138534/adminhtml/Magento/backend/en_US/extjs/resources/css/
I've been struggling with this all week. I've fresh installed both XAMPP and Magento, trying multiple versions.
I've tried different browsers, and changing my browsers settings, and clearing my browsers.
I've tried installing XAMPP and Magento on MacOS instead, and found a new issue, that prevented me from even getting to this step, which I then banged my head against for 6 hours or so before giving up and going back to Windows.
I've pored over the web trying to find a solutions, but I can't even find anyone with the same issue.
Obviously, I am doing something wrong... and I want to know what, but I just can't seem to find any answers.
do the static content deployment.
take backup of core_config_data table
go to phpmyadmin and run insert core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);
go to your magento root folder using command line.
run php bin\magento cache:flush
run php bin\magento setup:static-content:deploy -f
your problem will be resolved.
Solution:
If anyone is having the same issue, here is what worked for me.
I added "C:\xampp\php" to my system variables/path.
Search "System Properties" from the start menu and open it.(New Window)
Select the "Advanced" tab.
Click "Environment Variables". (New Window)
From "System Variables", select "Path".
Click "Edit"
Click "New"
Type "C:\xampp\php"
Hit "OK" x3.
This appears to have allowed me to use php commands in my command prompt.
Then, I ran the setup for the Magento file in "C:\xampp\htdocs\Magento\bin". (This may be redundant.)
[You can see a full list of available commands with "C:\xampp\htdocs\Magento\bin php Magento"]
Open a command prompt. (win+r, cmd, enter).
Navigate to the bin folder. (cd c:\xampp\htdocs\Magento{*this may be unique to your setup}\bin, enter)
Run the setup. (php Magento setup:install)
Finally, I deployed all static view files.
In the same directory as before deploy static files. (php Magento setup:static-content:deploy, enter)
After this, in a browser, I navigated to localhost/Magento, and ran through the Magento setup again, and the issue is resolved.
https://i.stack.imgur.com/gAEIQ.png

Laravel 5 drops "This site can’t be reached" when trying to download file

I have Laravel 5.2 and PHP7.
My host works as it should, except links that generate and download xlsx files using Laravel Excel. These links drop error "This site can’t be reached". All libraries within a project are installed (and I assume that if problem was in libraries, I would get 500s about missing classes or something like that).
Maybe some php extension is missing? What am I doing wrong?
UPD: the excel function itself works correctly, but site crashes on download
You should be using laravel homestead to instead missing webserver
1.installed VirtualBox
2.installed Vagrant
3.installed the Homestead Vagrant Box
4.cloned Homestead into my "home" directory
5.ran the bash init.sh command to create my Homestead.yaml file
6.configured my Homestead.yaml file:

Symfony completely ignores all the changes I make to code

I tryed click ctrl + r, ctrl f5. Clearing cashe launching application on other browsers. All I want to do is to start work and learn.
enter image description here
anything I do at app/recources/views/default/index.html.twag is completely ignores, I even tryed deleleting whole content of this file, than restarting pc and it still appear as default view. Any changes made to controller is also ignored. He finally starts to notice me when i completely delete index.html.twag file. When i return it back (completely empty by the way) he shows me his default view AGAIN!!!. Please help, any ides?
So eventualy problem was with cache. All I had to do is to run command at my console: php bin/console cache:clear --env=prod
Source: http://symfony.com/doc/current/console/usage.html
When you make changes to your Twig files or your controllers, you should always clear the cache using:
php bin/console cache:clear --env=prod
for your production environment.
The DEV environment is done automatically, but sometimes you still need to clear it with:
php bin/console cache:clear
To access the DEV environment, just append app_dev.php to your route URL. For example: http://localhost/wtf/app_dev.php
If you open that file under the web folder, you'll see you can also add in the IP addresses of remote hosts that you want to allow access.
Hope that helps you.

Magento 2 failed to open stream: No such file or directory 'vendor/magento/framework/registration.php'

I am not sure what's going on with my magento installation.
I downloaded the latest version of Magento 2.1.1 as zip.
Extracted, setup a database then tried running the install but I keep on getting this stup*d error and I could not find any answers online.
Can someone help me on this one please? Its been a while since I used magento since I got used to working with Wordpress websites.
I tried looking for the file manually, but just like the error said, it does not exist. Where can I find this registration.php file under magento/framework/ folder?
Try run this command in your magento root folder.
composer dumpautoload
Then reload page you've got this error.
Still not working ?. Fell free to reply :)
If you are using composer to Install, the solution is simple re run the commands from the Magento Root Folder.
Inside /vendor/autoload.php there is a Base Path Global Variable that take the path to execute the vendor_path.php, and, in my case, it take the path where I am and not the Root.
I hope this is helpful for someone.
Have a nice coding day
please run
composer dump-autoload
to reload composer autoload files this issue mostly when you update a library and then fall back to original but magento composer files doesn't fall back to original so you need to generate files again.

Categories