Friday, 14 February 2020

How to increase database file upload limit(import database file) in phpMyAdmin.

The default upload limit is 2MB to import any database in phpMyAdmin. So if have any file larger than 2MB to import, we would not be able to import the file to database.

You can increase this limit to upload any file size supported to server.

To increase file size, you have to open file php.ini

In Linux, this file can found in /etc directory.

In Windows, It can be opened by  click on WAMP server icon on Windows taskbar/ System tray.

Just click on WAMP icon -----> PHP -----php.ini






Find two entries in this file-

1.  upload_max_filesize
2.  posr_max_size

And change these values to your required file size e.g. 10M




Thursday, 13 February 2020

Error - "Forbidden : You don't have permission to acces /phpmyadmin/ on this server" on Linux server (CentOS 7).

After installing LAMP on your Linux server, if you are getting error like "Forbidden:You don't have permission to access /phpmyadmin/ on this server", then it means that you are accessing it from server ip address and it is allowed from only localhost or you are accessing it from localhost and it is allowed only from ip address. So what to do next?


Type command -

sudo gedit /etc/httpd/conf.d/phpMyAdmin.conf

You will get the phpMyAdmin.conf file and at top you will find following code

Chane the line Require ip 127.0.0.1 and Allow from 127.0.0.1 if you want to access it using localhost on local machine. If you want to access it using your system ip address  on local machine then change 127.0.0.1 to to your system ip address

<Directory /usr/share/phpMyAdmin/>
      AddDefaultCharset UTF-8
  
<IfModule mod_authz_core.c>
    # Apache 2.4
   <RequireAny>
        Require ip 127.0.0.1
        Require ip ::1
   </RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny, Allow
     Deny From All 
     Allow from 127.0.0.1
     Allow from ::1
</IfModule>
</Directory>
 
If you want to access this server from any machine then replace the above code with

<Directory /usr/share/phpMyAdmin/>
      AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
     # Apache 2.4

     <RequireAny>
       Require all granted
     </RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
     #Apache 2.2
      Order Allow, Deny
      Allow from all
      Allow from 127.0.0.1
      Allow from ::1
</IfModule>
</Directory>


Monday, 10 February 2020

Unable to access Tomcat server running on Linux from another machine.

If you have installed Tomcat server on Linux and it is working on properly on installed machine, but you are unable to access it from other machine. If both machines are connected properly but again you are unable to access this. Then you can try this method.

(If have used this on CentOS running Tomcat 9 server)

It might be problem of firewall, so please use this command-
(I suppose your Tomcat server is using port 8080, if it uses another then use that port number in command)

sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent

sudo firewall-cmd --reload



Sunday, 9 February 2020

Add multiple Jar file to classpath with javac command in Java.

Look how we can add multiple or single jar file to javac command.

Example given below for adding single jar file to javac-

javac -cp "absolute_path_of_jar_file" java_file_name.java
(javac -cp "F:\tomcat\lib\servlet-api.jar" test.java)

or

javac -classpath "absolute path of jar file" java_file_name.java

( javac -classpath "F:\tomcat\lib\servlet-api.jar" test.java )

For adding multiple files -

javac -cp "absolute path of jar file1; path of jar file2" java_file_ name.java

javac -classpath "absolute path of jar file1; path of jar file2" java_file_name.java

(javac -cp "F:\tomcat\lib\servlet-api.jar;F:\tomcat\webapps\file-sharing\WEB-INF\lib\anyjar.jar" test.java)

If all jar files in a same directory then, suppose if all in lib folder then

javac -cp "c:\tomcat\webapps\project\lib\*"  java_file_name.java

(javac -cp "F:\tomcat\lib\servlet-api.jar;F:\tomcat\webapps\file-sharing\WEB-INF\lib\*" test.java)

Change image source dynamically on hyperlink

 Changing image source dynamically using JQuery. Here in this example I have created there hyperlink and stored all images in the same folde...