I've installed XAMPP on my Linux computer and server and database are running. Now I have a question how to execute my existing PHP-Files from /home path?
So far I have saved all of my PHP files in ./home directory (e.g. /home/Path-to-PHP-Files/Development_01/....php) and until now I have uploaded them with FTP to server. In order to save myself from constant uploading, I thought that usage with XAMPP is faster and more elegant.
I found out that XAMPP apparently wants to save the PHP files in /opt/lampp/htdocs directory. Unfortunately I can neither call my PHP files from .home-directory in browser nor can I copy them to /opt/lampp/htdocs because this path is read-only.
How can I configure XAMPP to make my PHP files run in /home directory?
Change the DocumentRoot in your virtual hosts file, then restart XAMPP. Here is an example:
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "/home/Path-to-PHP-Files/Development_01/"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
<Directory C:/home/Path-to-PHP-Files/Development_01/> # or a linux path
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Related
Situation:
I have a website that iam working on, in my local machine
Server apache, php language.
In local i can access to the page by typing
http://localhost/(mysite)/public/index.php
Problem:
In the Hosting webserver, i want to access by
simply typing http://www.(mysite).com/index.php
Note: My website is based on mvc (Model view controller) architecture.
Question:
What is the appropriate way to « root » my website on the
« public » directory in my apache server.
Should i point the hosting web server document root to The « public/« directory ?
Thanks
On linux go edit /etc/apache2/sites-available/000-default.conf or mysite.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And append /public to whatever path you have as DocumentRoot
I bought a VPS server, where I installed apache, mysql, php and phpmyadmin. I created database (like in my local project).
So, now I want to migrate a local project to my server and please, tell me I am right:
Files .php has to be in folder var/www on my apache server? (here is index.html too) and from this folder connect with database?
I have to download NPM on ubuntu
I have to download GIT on ubuntu
Download repo from my github where I've got whole code (webpack dist files, node modules, src and whole config) to /var/www catalog
index.html has to be in top-level directory (just in var/www not for example var/www/src
Please help me and tell if I am thinking right.
Files .php has to be in folder var/www on my apache server? (here is index.html too) and from this folder connect with database?
It depends on what you set in /etc/apache2/sites-available/000-default.conf. I assume that you installed with default configuration from apt-get.
index.html has to be in top-level directory (just in var/www not for example var/www/src
If for example your source codes are in /var/www/src instead of /var/www, the just modify the 000-default.conf. Example:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName your_domain_name.com
DocumentRoot /var/www/src/
<Directory />
Options FollowSymLinks
AllowOverride None
Options -Indexes
</Directory>
<Directory /var/www/src>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
Options -Indexes
</Directory>
ErrorLog /var/log/your_log_file.log
LogLevel warn
CustomLog /var/log/your_access_log_file.log combined
</VirtualHost>
Restart Apache and try open in your browser to see if it works.
As for the database, since you have phpmyadmin, just export the sql data from your local machine and import it into the VPS phpmyadmin.
I am new to VPS hosting.... and giving a try to digital ocean Linux VPS. I need to point 2 domains to my PHP app.
This is how my Virtual Host looks like inside /etc/apache2/sites-available
<VirtualHost *:80>
ServerAdmin root#domain1.com
ServerName domain1.com
ServerAlias www.domain1.com
DocumentRoot /var/www/html
<Directory /var/www/html>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
However... I am not able to load my styling and access any files or directories that is in var/www/html directory. How can I enable the permissions for my domains to access these resources.
Similarly my second Virtual host for another domain
DocumentRoot /var/www/html/app/login.php
Everything seems working while I am accessing the site using the IP...However... after setting up virtual host... the content is loading but can not access css and js... in the current root directory.
I am not sure what I need to do to set up my domains as expected.
I am using ../ notation to point my previous directory. There is no error with the site that is showing...just not loading CSS. Also I have the APIs in the root directory.... inside API folder.... that is not accessible while I am pointing them ../../API/v1/create_user.php
I'm new to php, I did installed xampp-win32-1.8.2-2-VC9-installer on my window7 desktop pc. PHP page run from C:\xampp\htdocs but when i create virtual host and tried to access php file in d:\web\ it shows access forbidden.
my host file code
127.0.0.1 localhost1
my httpd-vhost file code
NameVirtualHost *
<VirtualHost *>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost localhost1:80>
DocumentRoot "d:/web/test.php"
ServerName localhost1
<Directory "d:/web/test.php">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I don't know now where i have to change
It's a file permissions derived issue. Try changing NTFS permissions in "C:/xampp/htdocs" to allow read and execute permissions to the user that is running the web server, you should be able to see who that user is in the Apache configuration file, tipically "apache" which is the equivalent to IUSR in IIS.
I'm using WAMPSERVER to run a wordpress site that has to be acessible by the users in my network, like a environment for testing together.
Localhost works fine, but at first i couldn't access the aplication from other computers in the network. I created a rule to open the port 80, created an Alias in the Apache configuration, and it worked but the theme and any images inside subfolders wouldn't load and the console was returning lots of 404 responses.
I want to map the subfolders and its files that are under the 'base dir' of the site. I tried tons of options in the Apache conf. file but i couldn't make it.
Attached a printscreen of the responses, the apache conf file and the windows hosts file
Httpd.conf :
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#animamidia
DocumentRoot "C:\wamp\www\website"
ServerName www.animamidia
ErrorLog "logs/animamidia-error.log"
CustomLog "logs/animamidia-access.log" common
<Directory "C:\wamp\www\website\*">
Options FollowSymLinks Includes
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Windows hosts file:
127.0.0.1 www.animamidia
The site with it's theme broken because the requisition returned a 404
Well i found the problem.
Even though i couldn't enter the wordpress-admin i decided to check the 'wp-config.php' file just in case something is wrong or missing.
And what i did find is that the 'Home-URL' and the 'WP-URL' were set at 'localhost/website' which means that all the requisitions would point at this location as a base directory.
All i had to do was to use the 'define' comand and set the site's URL to the machine's IP and now the environment is all set up for the guys over here to develop and test their stuff.