PhpStorm | Web server folder and project root aren't the same - ide

I'm trying to make a project with a public folder inside. That folder is where the web server is pointing at, but I can't make PhpStorm to understand that and open in the built-in browser the correct URL.
I mean:
Project root
|-- app
|-- config
|-- core
`-- public (Web server root folder)
`-- index.php

Related

Different location for the dotenv file that is not in the root folder of a Vue application?

Currently, I'm developing a web application that has the following file structure:
/client
|-- /public
|-- /src
config files
/server
|-- /src
config files
Root folder config files
In the root folder, I have a .env file which the "server" directory can access.
However, Vue expects a .env file in the root of it's file structure. So essentially in the "client" directory. If I add a .env file there, the variables are accessible. But I want Vue to access the .env file from the root folder of the whole project.
How can I achieve this? Thank you!

Debugging externally compiled Typescript in IntelliJ

I was trying to debug typescript with IntelliJ but I cannot get it working. I use webpack to build the typescript files and maps and only the compiled js is used in the page. I also use an external webserver, so I cannot use the build in IDEA webserver.
My structure looks as follows:
root
|-- compiled
|-- compiled.js
|-- compiled.js.map
|-- src
|-- file1.ts
|-- some_subfolder
|-- file2.ts
|-- ....
I setup a debug configuration for Javascript, installed the Chrome extension and did the path mappings. If I put a breakpoint into compiled.js, the breakpoint gets hit and I can debug. Breakpoints in my ts files are ignored though. I did mark the compiled folder as excluded as per documentation (it says the IDE will then autoload map files from these folders). As far as I can see there is no option to manually set a map file for the script file in the debug configuration.
Any ideas what I might be missing?

Deploying a Yii 2 app to a subdirectory of the document root

I want to deploy a Yii 2 app to a website's subdirectory:
http://example.com/subdirectory
My app's directory structure looks like this:
|-- LICENSE.md
|-- README.md
|-- assets
|-- commands
|-- components
|-- composer.json
|-- composer.lock
|-- config
|-- controllers
|-- mail
|-- models
|-- requirements.php
|-- runtime
|-- test.php
|-- test.txt
|-- tests
|-- vendor
|-- views
|-- web
|-- yii
`-- yii.bat
According to Yii 2's documentation, for deployment you're supposed to rename the web folder to the document root of your server, like public_html, wwww, etc. Then you copy all the files to the parent directory of the document root. But nothing is said about how to deploy the app to a subdirectory of the document root.
The host is Apache, and I'm wondering if using an alias is the easiest way. I'm not sure from the documentation on mod_alias which directive to use or where it should go, though.
What do you recommend?
It turned out to be simpler than I expected.
Move the web directory into your document root (e.g., public_html, www, etc.).
Rename the web directory how you want to appear after the domain name. For instance, if you want your app to live at http://example.com/myapp, then rename web to myapp.
Move your app's directory (which now should be minus the web subdirectory) one directory above your document root.
In the web directory, change the paths of the three require functions in index.php.
My modified index.php looks similar to the below. (If you copy and paste, remember to replace your_app_name with the name of your app's directory. Also note that I have multiple websites in my document root, so I have to get the parent of the parent of the parent of the web folder to make it out of the document root. Whew.)
<?php
// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/../../../your_app_name/vendor/autoload.php');
require(__DIR__ . '/../../../your_app_name/vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . '/../../../your_app_name/config/web.php');
(new yii\web\Application($config))->run();

include .htaccess in another directory into a main .htaccess

I was looking at making a folder structure like this
htdocs
|--app
|-- myProject
|-- index.php
|-- settings.ini
|-- .htaccess (project)
|--core
|--index.php
|--config.ini
|--.htaccess (main)
I waned some global .htaccess rules in the main .htaccess file but I wanted some project specific rules in the project .htaccess
Is there a way I can have both .htaccess fils co-exist? or have the project .htaccess file included in the main .htaccess?
I know in apache you can include files, because in my httpd.conf i have an include statement to include .conf files outside of the directory.
On my server I have exactly what you have here. One .htaccess file for the htdocs folder and one for another site.
I never had any problem, it seems that the .htaccess for the project overrides the .htaccess for htdocs.

How to make a custom ear file in maven

Here is my challenge, I need to make an ear file for a specific container. To be more specific on how this ear will be created:
This is a standard j2ee ear file, with 1 WAR in it.
The container it is deployed to will expect certain xml files (which can easily be found (somewhere) inside the source project).
Here are my obstacles
The source folder contains various container specific xml files. But, these files do not map directly to where the container expects them inside the EAR file. For example, there will be a file that this container expects to be in 'EARFILE.ear/config/connections.xml'. But this file is located (in the source) at /some/obscure/unrelated/directory. This is the case for about 5-7 files.
I cannot change the original source project layout at all.
So, how can I create the compliant EAR file that I need. There is NO plugin at this time for the container that I am using, I have certainly looked.
Update:
The original layout is for JDeveloper:
.adf
/META-INF/
(some xml files to map to various locations in the EAR)
Model
ViewController
public_html
src/
META-INF/
(some xml files to map to various locations in the EAR)
This is a standard j2ee ear file, with 1 WAR in it. The container it is deployed to will expect certain xml files (which can easily be found (somewhere) inside the source project).
As I told you in this previous answer, the typical layout for a maven project with a war and an ear module would look like this:
.
|-- ear
| |-- src
| | `-- main
| | `-- application
| | |-- META-INF
| | | `-- application.xml
| | `-- config
| | `-- connections.xml
| `-- pom.xml
|-- web
| +-- src
| `-- pom.xml
`-- pom.xml
Where the files under the ${basedir}/src/main/application directory will be included in the EAR (this is the default value of the earSourceDirectory parameter).
The source folder contains various container specific xml files. But, these files do not map directly to where the container expects them inside the EAR file. (...)
I'm sorry but... what source folder? It would be maybe possible to use the Maven AntRun plugin to copy some files to the ear project from another location but 1. that would be very messy and 2. without more details, it is impossible to provide more guidance.
I cannot change the original source project layout at all.
Which looks like? You really need to give more details (and if you can't change anything, mavenizing this project may not be easy at all, especially if you're new to maven).