Search blog

Showing posts with label Apache Web Server. Show all posts
Showing posts with label Apache Web Server. Show all posts

Thursday, February 2, 2023

[SOLVED] - Install phpMyAdmin & LAMP on Ubuntu 20.04 Desktop

Install phpMyAdmin & Linux, Apache, MySQL/MariaDB & PHP [LAMP] on Ubuntu 20.04 desktop.

Below you will find the instructions that I myself have tried and successfully implemented on my system.

 1. Install Apache Web Server

 sudo apt update  
 sudo apt install apache2  

2. Install MariaDB

 sudo apt install mariadb-server  
 sudo apt install mariadb-client  

After that, run the commands below to secure the MariaDB server by creating a root password, disallowing remote root access removing anonymous, and more.
 sudo mysql_secure_installation  
 If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here.  
 Enter current password for root (enter for none): PRESS ENTER  
 Switch to unix_socket authentication [Y/n] n  
 Change the root password? [Y/n] n  
 Remove anonymous users? [Y/n] y  
 Disallow root login remotely? [Y/n] y  
 Remove test database and access to it? [Y/n] y  
 Reload privilege tables now? [Y/n] y  
 All done!  

3. Install PHP

 sudo apt install php7.4 php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip  

4. Install phpMyAdmin

 sudo apt install phpmyadmin  

When prompted to choose the web server, select apache2 and continue.
   
Install phpMyAdmin, Apache, PHP, MySQL or MariaDB on Ubuntu 20.04 Desktop

When prompted again to allow web config-common to install a database and configure select Yes and press ENTER.

Then type and confirm a password.

Install phpMyAdmin, Apache, PHP, MySQL or MariaDB on Ubuntu 20.04 Desktop

After installing phpMyAdmin, open your web browser and browse to the server hostname or IP address followed by /phpmyadmin.
 http://localhost/phpmyadmin  
Install phpMyAdmin, Apache, PHP, MySQL or MariaDB on Ubuntu 20.04 Desktop
If you encounter the following error implement the solution below to resolve the issue:

ERROR: mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'

Open your terminal and run the following commands:
 sudo mysql -u root  
 use mysql;  
 update user set plugin='' where User='root';  
 flush privileges;  
 \q  
Now the LAMP cum phpMyAdmin should be working for you.

>> Ref:

Tuesday, February 12, 2019

[SOLVED] - Alibaba Cloud (ECS) - The Requested URL Could Not Be Retrieved. Unable to Access Website

[SOLVED] - Alibaba Cloud (ECS) - The Requested URL Could Not Be Retrieved. Unable to Access Website


ERROR

The requested URL could not be retrieved

The following error was encountered while trying to retrieve the URL: http://149.x.x.1/

    Connection to
149.x.x.1/ failed.

The system returned: (111) Connection refused

The remote host or network may be down. Please try the request again.

Your cache administrator is webmaster.

Solution

Today after restoring my snapshot to one of my Alibaba Cloud ECS instance; I was unable to access my website from my browser. I tried a lot of this and that but all in vain. Then finally, after much research, I read that the connection was getting refused by my Web Server, in my case the Apache Web Server.

Once I restarted, the Web Server, the website was accessible now.

Command to restart the Apache Web Server:

For Ubuntu:
 sudo service apache2 restart  

For RHEL/CentOS 7:
 systemctl restart httpd  

Wednesday, November 15, 2017

How to Find/Edit Location/Path of php.ini File in your Ubuntu/LAMP Setup

In some cases, you might have two PHP configuration files: one for the PHP command line and for the web server. If so, make the change in both php.ini files.

1. To Edit web server's php.ini file


Open any text editor of you choice like Gedit and Copy/Paste the following PHP code and Save the file as 'info.php' inside the Document Root folder of your Web Server. Usually the path to your Document Root should be something like '/var/www/html/'. Make sure to save your file under the 'html' folder.

 <?php   
 phpinfo();   
 ?>  

Now access this file from a browser using the following URL: http://localhost/info.php

You should be seeing a page open as shown in the image below. The path to your 'php.ini' file will be under Loaded Configuration File. In my case the path was as follows: Loaded Configuration File    /etc/php/5.6/apache2/php.ini

How to Find/Edit Location/Path of php.ini File in your Ubuntu/LAMP Setup
Click on image to enlarge




2. To Edit CLI's 'php.ini' file


Open your Terminal (CTRL+ALT+T) and enter the following command:
 php --ini  

You should get output as shown in the image below. Here too you should be looking for the Loaded Configuration File path. In my case it was /etc/php/5.6/cli/php.ini.

Edit CLI's 'php.ini' file
Click on image to enlarge

Sunday, March 26, 2017

[SOLVED] - Add Currently Logged in User to Apache User & Group [www-data:www-data]

If you are experiencing permission issues with your web directories and files, use the following commands to resolve it, This solution is very helpful if you are trying to run Wordpress/Other CMS in localhost environment:

1. Adds the currently logged in user to the www-data group.

 sudo usermod -aG www-data $USER  

2. Changes the ownership of the /var/www directory to www-data group.
 sudo chown -R www-data:www-data /var/www directory_name

3. Sets the proper permissions so you can upload files via sftp, manage files via command-line, and upload plugins and media directly in WordPress.
 sudo chmod -R 774 /var/www directory_name

Sunday, January 3, 2016

Updating PHP & MySQL in Ubuntu 14.04

1. Updating PHP 5.5 to PHP 5.6

To upgrade to a newer version of PHP 5.6 on Ubuntu 14.04, you can use Ondřej Surý's PPA. He is one of the Debian maintainers of the php5 package. Also not that this update will overwrite any change you made to your 'php.ini' files. So, I recommend you make a back up of your 'php.ini' file and later on you can use it as a reference file to make changes in your new 'php.ini' file.

To add the PPA and upgrade your packages, run:

 sudo apt-get install software-properties-common  
 sudo add-apt-repository ppa:ondrej/php5-5.6  
 sudo apt-get update  
 sudo apt-get upgrade  
 sudo apt-get install php5  

1. Updating MySQL 5.5 to MySQL 5.6

 step 1 : take a backup  
 mysqldump --lock-all-tables -u root -p --all-databases > dump.sql  
 step 2 : remove old mysql  
 sudo apt-get remove mysql-server  
 sudo apt-get autoremove  
 step 3 : install new version of mysql  
 sudo apt-get install mysql-client-5.6 mysql-client-core-5.6  
 sudo apt-get install mysql-server-5.6  
 step 4 : restore your data  
 mysql -u root -p < dump.sql  

3. If error after logging into phpMyAdmin:

If you happen to get an error as below:

'Your PHP MySQL library version 5.5.46 differs from your MySQL server version 5.6.27.....'

Run the following commands:

 sudo apt-get remove php5-mysql  

You might have to reinstall your phpMyadmin.

To reinstall phpMyadmin enter the following commands:

 sudo apt-get install phpmyadmin  

Saturday, December 26, 2015

[Solved] - Could not reliably determine the server's fully qualified domain name...

Error: 'AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message, ubuntu 14.04'

Solution: 

In new version of apache2 you just following command like this:

 sudo nano /etc/apache2/apache2.conf  

Add the following new line end of file:

 ServerName localhost  

Then restart apache2:

 sudo nano service apache restart  

It's done!

Source: http://askubuntu.com/questions/256013/could-not-reliably-determine-the-servers-fully-qualified-domain-name

Monday, September 7, 2015

[Solved] Magento 500 Internal Server Errors in Ubuntu

I purchased a Magento theme from themeforest and was trying to run a test install in my localhost under Ubuntu. I googled and tried various solutions but all in vain. Perhaps they might work for you and you may give it a try at by visiting the following link: How to Solve Magento 500 Internal Server Errors. But if that does not help you can try doing what I did.

1. Firstly go and check your Apache Error Logs at: '/var/log/apache2/error.log'

2. There check if you are getting an error such as:

[Mon Sep 07 12:40:40.533934 2015] [core:alert] [pid 31413] [client 127.0.0.1:47560] /var/www/html/magento/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

To resolve this open your Terminal by pressing CTRL+ALT+T and enter the following commands. Basically what you are doing is what is called the mod_headers:

 sudo a2enmod headers  

and then restart your Apache web server:

 service apache2 restart  

Now try accessing your website and it should work!

Monday, May 18, 2015

Increasing the Script Timeout Limit in phpMyAdmin in Ubuntu 15.04 and other LAMP Servers

If you are facing problems importing your database dump into your  MySQL server using phpMyAdmin follow the steps below to resovle the issue:

Open the 'config.inc.php' file located inside '/etc/phpmyadmin/config.inc.php' and add the following line:
 $cfg['ExecTimeLimit'] = 0;  

This will remove any time constraint in phpMyAdmin for database import.

Now make the following changes in your 'php.ini' file which is located at '/etc/php5/apache2/php.ini.' You will have to sudo and open your editor to make/commit the changes:
 post_max_size = 750M  
 upload_max_filesize = 750M  
 max_execution_time = 300  
 max_input_time = 540  
 memory_limit = 1000M  

Now finally restart your Apache Web Server:
 sudo service apache2 restart  

Friday, April 3, 2015

How do I enable directory listings for a folder on my Web site?

If a directory doesn't contain an index file (a file named "index.html", "index.htm", "index.php", etc.), Web servers will normally show an error message if someone uses a Web browser to visit the URL address of that directory.

This provides security for your files: it prevents strangers from viewing the names of all files in a directory and snooping through them, possibly finding files that are intended to be private.

However, if you actually want your site visitors to be able to see all the files in a directory, you can do that by placing a file named .htaccess in the directory. The file should contain this line of text:

 Options +Indexes  
(This command is explained in the Apache Web server documentation.)

After you do that (and also remove any index file such as "index.html" from the directory), anyone visiting the address of the directory will be able to view a list of all files in it and click on the individual files to open them.

Advanced directory listing customization

You can customize the directory listings by setting certain options for the mod_autoindex module.

The following lines display a file's full name, no matter how long it is:

 Options +Indexes  
 IndexOptions FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=*  

Or you can set a character length limit, like this:

 Options +Indexes  
 IndexOptions FancyIndexing FoldersFirst NameWidth=30 DescriptionWidth=30  

You can suppress the display of file icons by adding the SuppressIcon option:

 Options +Indexes  
 IndexOptions FancyIndexing FoldersFirst SuppressIcon  

See the Apache Web server mod_autoindex documentation for full details about IndexOptions.

Source: https://support.tigertech.net/directory-index

Sunday, April 7, 2013

Increase Max Upload Size in phpMyAdmin

To increase the max upload size in phpMyAdmin simply change this value in php.ini file. This file is located inside the php folder. Once changed restart your Apache server.

post_max_size = 100M
upload_max_filesize = 100M

Keep both the above values equal else phpMyAdmin will use the smallest values from both the given values.

 

Sunday, March 4, 2012

How to view Apache error log files in Windows?

If you ever wanted to view your Apache Log files from your local computer or Windows Operating System (Xp, Vista, Windows 7) and were unable to do so, this awesome software can do the task for you. You must have noticed the log files are usually very large in size  and won't open in text editors like Notepad causing them to hang.

As the website states "Apache Logs Viewer (ALV) is a free and powerful tool which lets you monitor, view and analyze Apache/IIS logs with more ease. It offers search and filter functionality for the log file, highlighting the various http requests based on their status code. There is also a report facility, thus you can generate a pie/bar chart in seconds. Together with this there are also statistics where you can get the top hits, top errors, number of status codes, total bandwidth and more."

So here are the links:

1. Setup File: http://www.apacheviewer.com/download.php?new=1
2. Help File: http://www.apacheviewer.com/ApacheLogsViewer_Help.pdf

Saturday, February 18, 2012

Creating Virtual Hosts on Apache Web Server

For setting up Virtual Host in XAMPP 1.8.1 please visit the following page: http://soluzione08.blogspot.in/2012/12/creating-virtual-host-on-xampp-181.html

Note: The settings below are for general websites. For Drupal specific settings visit the following page: http://drupal.org/node/161975

When it’s first installed, Apache is capable of hosting only one website, which is identified in a local testing environment by the URL http://localhost/. To get around this restriction, it’s common practice to develop websites in subfolders of the Apache server root. For example, if you have two sites called site1 and site2 and create separate subfolders for them in the server root, you access them in your testing environment as http:// localhost/site1/ and http://localhost/site2/. This works perfectly well as long as you use document-relative links all the time. However, if you want to use links relative to the site root, you need to create virtual hosts for each site.

Virtual hosting is a technique that web servers use to host more than one website on the same machine. If you have bought a web-hosting package from a hosting company, it’s almost certainly on a shared server that uses virtual hosts. Continuing with the previous example, once you create virtual hosts for site1 and site2 in Apache, you can test them locally using http://site1/ and http://site2/. This is essential for testing sites that use links relative to the site root. If you’re serious about web development, you should learn sooner or later how to set up virtual hosts in your testing environment. Once you have mastered the technique, it takes only a few minutes to set up each one.

You can call your virtual hosts whatever you like, as long as you don’t use any spaces or characters that would be illegal in a domain name. I always use the same name as the actual website, without the top-level domain. For example, for my own site, http://foundationphp.com/, I have created a virtual host called foundationphp in my local testing setup. This means that I access it as http://foundationphp/. It’s then a simple matter of clicking in the browser address bar and adding the .com to see the live site. Whatever you do, don’t use the top-level domain as the name of a virtual host in your testing setup. If you do, your computer will always point to the local version of the site and never access the real one on the Internet.

Apache allows you to create as many virtual hosts as you want. It’s a two-stage process. First, you tell the operating system the names of the virtual hosts, and then you tell Apache where the files will be located. There are separate instructions for Windows and Mac OS X.

Registering virtual hosts on Windows


Although you can locate your virtual hosts anywhere on your hard drive system, it’s a good idea to keep them in a single top-level folder, as this makes it easier to set the correct permissions in Apache. The following instructions assume that all your virtual hosts are kept in a folder called C:\vhosts and show you how to create a virtual host called dwcs4 within that folder.

To edit the necessary files in Vista, you need to select Run as administrator even if you are logged in to an administrator account. For Notepad, go to Start ➤ All Programs ➤ Accessories, right-click Notepad, and select Run as administrator from the context menu.
Enter your administrator password when prompted. Inside Notepad, select File ➤ Open and navigate to the relevant file. The Open dialog box in Notepad shows only .txt files, so you need to select All Files (*.*) from the drop-down menu at the bottom right of the dialog box.

STEPS For Configuration:


1. Create a folder called C:\vhosts and a subfolder inside it called dwcs4.

2. Open C:\WINDOWS\system32\drivers\etc\hosts in Notepad or a script editor and look for the following line at the bottom of the file:
127.0.0.1 localhost
127.0.0.1 is the IP address that every computer uses to refer to itself.
3. On a separate line, enter 127.0.0.1, followed by some space and the name of the virtual host. For instance, to set up a virtual host for this book, enter the following:
127.0.0.1 dwcs4 or 127.0.0.1 sackid.local and also set ServerName (see bottom page to know more) also to sackid.local if you want something like http://sackid.local
4. If you want to register any further virtual hosts, add each one on a separate line and point to the same IP address. Save the hosts file and close it.

5. Open the Apache configuration file, httpd.conf. The default location is C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf. If you installed XAMPP, it should be at C:\xampp\apache\conf\httpd.conf.

6. Scroll down to the Supplemental configuration section at the end of httpd.conf, and locate the following section:
7. Apache uses the hash sign (#) to indicate comments in its configuration files.  Uncomment the command shown on line 463 in the preceding screenshot by removing the #, like this:
Include conf/extra/httpd-vhosts.conf
This tells Apache to include the virtual host configuration file, which you must now edit.

8. Save httpd.conf, and close it.

9. Open httpd-vhosts.conf. The default location is C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra\httpd-vhosts.conf. If you installed XAMPP, it should be at C:\xampp\apache\conf\extra\httpd-vhosts.conf. The main part of the file looks like this:

10. Position your cursor in the blank space shown on line 15 in the preceding screenshot, and insert the following four lines of code:

<Directory C:/vhosts>
Order Deny,Allow
Allow from all
</Directory>


This sets the correct permissions for the folder that contains the sites you want to treat as virtual hosts. If you chose a location other than C:\vhosts as the top-level folder, replace the pathname in the first line. Remember to use forward slashes in place of backward slashes. Also surround the pathname in quotes if it contains any spaces.

11. Lines 27–42 in the preceding screenshot are examples of virtual host definitions. They show all the commands that can be used, but only DocumentRoot and ServerName are required. When you enable virtual hosting, Apache disables the main server root, so the first definition needs to reproduce the original server root. You then add each new virtual host within a pair of <VirtualHost> tags, using the location of the site’s web files as the value for DocumentRoot and the name of the virtual host for ServerName. If the path contains any spaces, enclose the whole path in quotes. If your server root is located, like mine, at C:\htdocs, and you are adding dwcs4 as a virtual host in C:\vhosts, change the code shown on lines 27–42 so they look like this:

<VirtualHost *:80>
DocumentRoot c:/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot c:/vhosts/dwcs4
ServerName sackid.local
</VirtualHost>


For XAMPP, use C:/xampp/htdocs instead of C:/htdocs.

12. Save httpd-vhosts.conf, and restart Apache. All sites in the server root will continue to be accessible through http://localhost/sitename/. Anything in a virtual host will be accessible through a direct address, such as http://dwcs4/.

Top 5 Posts (Weekly)