How to set DocumentRoot in httpd.conf to windows environment variable - windows-7-x64

First I want to say thanks to community for all the answers I've found here in the past. I'd like to set the DocumentRoot line in the http.conf file to the current windows user's dropbox folder. I thought you could do it by doing something like...
DocumentRoot "C:/Users/${USERNAME}/Dropbox/"
&
but that isn't working. Is there a way to set config files to Windows environment variables?

Related

Magento 2 moving Apache docroot to pub directory

I've recently performed a Magento security scan and it recommended I move the root of my Magento 2 installation to the pub directory.
I've followed the instructions here but I've had no success. The site fails to find the images and merged CSS files. I have double checked that the CSS files and images exist in their respective directories in pub/static.
My Apache configuration:
DocumentRoot /var/www/html/magento2/pub
ServerName www.somedomainorother.co.uk
ServerAlias somedomainorother.co.uk
<Directory "/var/www/html/magento2/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I am using Apache 2.4, Centos 7.3.
Has anybody run across a problem like this before and how did you fix it?
I had exactly the same issue and the root cause I found that Magento was still looking for the static resources under [site_url]/pub/static or (if static versioning is enabled):
[site_url]/version[NNNNNN]/pub/static
While they should have been requested according to the new root
[site_url]/version[NNNNNN]/static
I had to check the static and media urls, in core_config_data I found [site_url]/pub/media and [site_url]/pub/static as values for base_media_url, base_static_url for secure and unsecure. I simply removed these config records from core_config_data and left the application to retrieve them correctly by default.
I assume you have tried the usual trick of:
php bin/magento setup:static-content:deploy
You may need to add an '-f' after depending on which mode you are in. Also, if you are using a language different to 'en_US' then you woul dneed to add that at the end. I have to do this:
php bin/magento setup:static-content:deploy -f en_GB
This has helped me get out of those CSS and image screw ups.
Otherwise I would look at maybe it being a permissions issue?

Change httpd.conf of specific user

I want to change the httpd.conf file of a specific user on our server. I've found the main httpd.conf file, but I can't find the httpd.conf file for a specific user.
I'm running CentOs 6.4
Found it: /usr/local/directadmin/data/users/USER/httpd.conf

Setting up XDEBUG in my dev environment

At my company, our PHP file isn't configured to use XDEBUG. This is making me feel like a blind man when trying to fix bugs and I absolutely need the debugger to understand the flow of code. We develop remotely, with our servers set elsewhere. I want to configure the php.ini file to have xdebug but more importantly I want to do this specifically for my development environment. Essentially the php.ini file i intend to alter resides in
/etc folder. (needs root access, I have root access)
Our dev folder is more like:
developer1 developer2 developer3 developer4 developer5 myDevelopmentEnvironment
So technically, i want to edit this php.ini file but have the settings changed only for myDevelopmentEnvironment, essentially override the main php.ini file in my folder.
Other particulars of interest :
Development machine : Windows
Server : linux (I putty in)
Editor: Eclipse (may move to NetBeans)
You can enable XDEBUG from an .htaccess file,
Eg.
php_value zend_extension=/usr/lib/php/modules/xdebug.so
php_flag xdebug.remote_enable on
php_value xdebug.remote_port 9000
php_value xdebug.idekey PHPSTORM-XDEBUG
php_flag xdebug.remote_connect_back on

Where is the web server root directory in WAMP?

Also is the web server root directory the place where you put your site files and later acces them with localhost/file_name in the browser?
If you installed WAMP to c:\wamp then I believe your webserver root directory would be c:\wamp\www, however this might vary depending on version.
Yes, this is where you would put your site files to access them through a browser.
In WAMP the files are served by the Apache component (the A in WAMP).
In Apache, by default the files served are located in the subdirectory htdocs of the installation directory. But this can be changed, and is actually changed when WAMP installs Apache.
The location from where the files are served is named the DocumentRoot, and is defined using a variable in Apache configuration file. The default value is the subdirectory htdocs relative to what is named the ServerRoot directory.
By default the ServerRoot is the installation directory of Apache. However this can also be redefined into the configuration file, or using the -d option of the command httpd which is used to launch Apache. The value in the configuration file overrides the -d option.
The configuration file is by default conf/httpd.conf relative to ServerRoot. But this can be changed using the -f option of command httpd.
When WAMP installs itself, it modify the default configuration file with DocumentRoot c:/wamp/www/. The files to be served need to be located here and not in the htdocs default directory.
You may change this location set by WAMP, either by modifying DocumentRoot in the default configuration file, or by using one of the two command line options -f or -d which point explicitly or implicity to a new configuration file which may hold a different value for DocumentRoot (in that case the new file needs to contain this definition, but also the rest of the configuration found in the default configuration file).
Everything suggested by user "mins" is correct, and excellent information.
WAMP 2.5 provides a default Server Configuration display when you enter localhost into your browser. This maps to c:\wamp\www, as described in previous posts. Creating subdirectories under www will cause Projects to appear on this display. A click and you're in your project.
I have various projects under different directory structures, sometimes on shared drives which makes this centralized location of files inconvenient. Luckily, there is a second feature of WAMP 2.5, an Alias, which makes specifying the location of one (or more) disparate web directories quite easy. No editing of configuration files. Using the WAMP menu, choose Apache > Alias directories > Add an Alias.
WAMP has evolved nicely to provide support for a variety of developer preferences.
If you use Bitnami installer for wampstack, go to:
c:/Bitnami/wampstack-5.6.24-0/apache/conf (of course your version number may be different)
Open the file:
httpd.conf in a text editor like Visual Studio code or Notepad ++
Do a search for "DocumentRoot". See image.
You will be able to change the directory in this file.
To check what is your root directory go to httpd.conf file of apache and search for "DocumentRoot".The location following it is your root directory
this is the path to the web root directory c:\wamp\www
you can create different projects by adding different folders to this directory and call them like:
localhost/project1 from browser
this will run the index.html or index.php, lying inside project1
Here's how I get there using Version 3.0.6 on Windows

Installing Zend framework with WAMP server

I'm trying to install Zend framework on a WAMP server but it is not working properly.
I downloaded the Zend framework and created the folder in C:\wamp\library\Zend, and then in php.inc I have something like this:
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes:C:\wamp\library"
Now when I try to run the sample blogger.php it is giving me the following error:
Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\PHPSample\Blogger.php on line 37
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='.;C:\php5\pear') in C:\wamp\www\PHPSample\Blogger.php on line 37
Can anyone help me please?
On Windows your php.ini should have a section like this:
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
; Windows: "\path1;\path2"
The key is to a) remove the semi-colon at the beginning of the line, and b) add what you need to the path. NOTE: on Windows, paths must be separated by semi-colons, whereas on UNIX they are separated by full colons; Also, Dot means "current directory", so only include it if you want to.
Make sure it looks like this:
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
include_path = ".;c:\php\includes;c:\wamp\library"
Zend Installation:- Download Zend Framework
Go to Wamp/bin/php/
Create a folder Namely:- Zend_Framework
Copy All the Files and Folder of Downloaded Zend Framework.
Go to php.ini and find include_path
Here you find:- include_path="c:\php\includes"
and replace the text between "" from your directory C:\wamp\bin\php\zend_framework\library
and Save File.
Now Go to Computer Property and Advanced System Setting and Advanced and Environment Variable and
select path from system variables and click on Edit and add ; and paste your directory path hare
C:\wamp\bin\php\zend_framework\bin
Open Command Prompt and go to the www directory inside wamp and then type zf create project Zendy
Now go to httpd.conf file and type there <virtualHost></virtualHost> Tags.
<virtualHost 127.0.0.1>
DocumentRoot "C:\www\Zendy\public"
ServerName Zendy
<Directory "C:\www\Zendy\public">
AllowOverride AuthConfig FileInfo Indexes Limit Options
order Deny,Allow
Allow from all
</Directory>
</virtualHost>
Save and Quit and go to windows -> System32 -> drivers-> etc-> hosts and Add here your project
127.0.0.1 localhost Zendy
Save and Quit and Restart Apache
Also set rewrite module via removing ; from php.ini file
i had made this cast explaining how to setup Many ZF Application with Wamp full functional
please check it out and let me know if you had any problem so i can help :
Getting Started with the Zend Framework and WAMP Server
that should work if:
you unpacked contents of the library folder in archive that contains Zend framework in
C:\wamp\library folder. othervise you need to do that ( put the contents of the library folder in archive in path you specified in php.ini