compile php one time for allways - php

I am making php program to run on local network and I want to give it to some other peoples to use. but I don't want to ask them to install XAMPP or other programs like this. (XAMPP is about 100 MB and they cant download it) is there any other way to make Apache and MySQL server easier on a system. for example they run a batch file and the file make server on port 80 and copy my scripts on its htdocs (or something like this) folder.
My second problem in XAMPP is PhpMyAdmin, which allow all devices in local network to manage my program databases and change them. I need a trick to disable PhpMyAdmin in client devices.
Sorry for bad English. :)

Xampp on windows is set to allow phpmyadmin from your local network. To disable access from your network, Open httpd-xampp.conf located in xampp-folder\apache\conf\extra\httpd-xampp.conf Somewhere down in the bottom of this configuration file is the LocationMatch node Even though you would think the default Order is set to deny, allow with Deny from all. This configuration by default is set to Allow from 192.168.0.#. Remove this ip range and you are set. Change this
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Deny from all
Allow from ::1 127.0.0.0/8 \
fc00::/7 10.0.0.0/8 172.16.0.0/12 \
fe80::/10 169.254.0.0/16
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
Don’t forget to restart Apache. Now http://localhost/phpmyadmin will result 403 Forbidden error.

If your computer and the other computers(computers which like to access) in the same network, the other computers can have access to the web application from the browser by inserting localhost/yourproject to [your-ip-address]/yourproject. Not only computer but also from your mobile device.
The only and the other way is hosting on the web.

Related

404 error page is allowing access to my database

I'm new to programming and I'm developing an online application using Laravel, with XAMPP (on Windows) to host the database. Now when I test the login page I have noticed that when someone types a wrong URL
Example: localhost/mysitename/home/wrong name
it is displaying a 404 error page with a "go home" button at the bottom which can direct anyone to the database through phpMyAdmin.
Is there any way to fix this?
For starters, restrict your phpMyadmin to only the local host or an IP address on your local network. Find the conf file and make the following changes. Adjust the IP to something that you know.
/etc/phpmyadmin/apache.conf
<Directory /usr/share/phpmyadmin>
Add the following lines at the top:
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Next - You really need to look into how to correctly configure Apache and other web services before exposing your front-end.

WAMP server error 403 Forbidden

Disclaimer: I know this question has been asked before by many others, but I have read quite a few of those posts and none of the solutions have worked.
I changed the httpd.conf file from
Require local
to
Allow from all
Keep in mind that every time it doesn't work I change the code back to normal and try a different solution.
I can access it from my own computer but when I ask my friend to try the site it give him error 403 forbidden and tells him he has no access to '/'
If your original httpd.conf has the Require syntax then it is Apache 2.4
The Allow from all is Apache 2.2 syntax. Its best NOT to mix them up within the same httpd.conf file
If you really want to allow any ip in the universe to use your web site and you are running Apache 2.4 then us
Require all granted
Alternativeley if you just want to be able to get to your web server from your local network something like this is safer
Require ip 192.168.1
Note: use of only 3 of the 4 quartiles, gives access to any ip that starts 192.168.1 i.e any ip on the local network subnet
Documetation for Apache mod_authx_code can be found here

how to access localhost website from diffrent computers other than hosted computer with local area connection

I tried to open my website from other computer performing steps explained at
How do I connect to this localhost from another computer on the same network?
It working fine too. But at "step 3b" I need to do changes in host file for opening it and I don't want that I want website should open once url is given without making changes in other pc or want to restrict access by giving client ip in httpd-vhosts.conf. I want all computers to access website connect in local area network.
How can I do this?
I tried editing httpd-xampp.conf
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Allow from all
Allow from ::1 127.0.0.0/8 \
fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
fe80::/10 169.254.0.0/16
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
It's not working too...
This may be help you.
setup your pc with static ip address like 192.168.1.200
create server directory in your htdocs/www directory
and make that server directory share
change localhost port in your appache configuration file to 1234
restart xampp/wamp server.
now go to other system and hit this url: 192.168.1.200:1234/server/your-project
to set static ip: http://www.howtogeek.com/howto/19249/how-to-assign-a-static-ip-address-in-xp-vista-or-windows-7/
To change localhost port: How to change XAMPP apache server port?

Cannot create local copy of Magento

I'm trying to create a copy of an existing Magento website on my localhost for developing purposes.
I followed all the steps listed here: Copy ec2 files to local
I also created a fake domain for my localhost so that there’s a “.” in it as I read somewhere this is required by magento. So now my localhost fake URL is something like: www.mysite.local
I have XAMPP installed on OS X 10.9.1 and I placed the magento filesystem as follows:
/Applications/XAMPP/xamppfiles/htdocs/magento/
In the database I added the local URL as follows:
update core_config_data
set value = ‘http://www.mysite.local/’
where config_id = 6;
and on local.xml I entered the following parameters:
<host><![CDATA[localhost]]></host>
<username><![CDATA[myusername]]></username>
<password><![CDATA[mypassword]]></password>
<dbname><![CDATA[mydatabase]]></dbname>
where localhost is just localhost, myusername is the username for the db I restored on my local XAMPP server, mypassword is the password for that same db, mydatabase is the name of the same db.
Still, when I browse to www.mysite.local/magento/ or www.mysite.local I don’t see anything appear.
What am I doing wrong?
Thank you so much!
If you're using a local server, here's some basic trouble shooting to help you debug:
Firstly, is the local server active? Can you visit http://localhost without it displaying server not found? If you can't, your local server is most not running. Try firing up xampp and launching Apache.
Secondly, it seems you're trying to create a virtual host for your local server. That's great! Virtual hosts allow you to create individual URLs for projects on the same server. E.g. http://myproject.dev.
However, you first need to make sure that the server understands what you're doing.
You will need to create a virtual host in your server if you haven't already.
I see you're using xampp. What you need to do is navigate to your xampp install, and edit your apache/conf/extra/httpd-vhosts.conf file, which is the file xampp recommends you use solely for virtual hosts.
Reading: Setting Up Virtual Hosts for XAMPP
For example, in Apache, a hosts config file may look like this:
# Base
<VirtualHost *:80>
DocumentRoot "X:/"
ServerName localhost
</VirtualHost>
# Project - Some Project of Mine
<VirtualHost *:80>
DocumentRoot "X:/projects/myproject/public"
ServerName myproject.dev
ErrorLog X:/projects/myproject/logs/apache.error.log
CustomLog X:/projects/myproject/logs/apache.access.log common
php_value error_log X:/projects/myproject/logs/php.error.log
</VirtualHost>
(navigating to myproject.dev displays the files in my X:/projects/myproject/public directory)
This answer is not to explain virtual hosts to you however. There are plenty of amazing resources online to help you get started with setting up your own.
Don't forget to restart your server when you add a virtual host!
If this is already set up, is your computer's hosts file set up to point to your server?
Your hosts file on your computer is used to tell it to do certain actions when you enter a matching url in your browser.
Reading: The Hosts File and what it can do for you
Reading: How to Edit Your Hosts File
For example, using the apache conf file settings above, my hosts file must also include:
# My project - Localhost
127.0.0.1 myproject.dev
It tells my computer to send the request to my local server (at localhost) when I use the URL myproject.dev. The local server then picks up the request, sees that you're accessing myproject.dev and checks if it has any virtual hosts matching that name. Well, whaddya know, it does! It then looks at the DocumentRoot setting for the location of the server files, and continues the process. Think of your hosts file as a local DNS of sorts.
If you've just added the site to your hosts file, it may take a few minutes to start resolving correctly. Wait a little, clear your browser cache and try again.
Finally, if these steps are done, and you're receiving nothing, it may be a server configuration problem, or a .htaccess issue.
If you're running on windows, you can check your event log for apache server errors. If you have set up logging on the virtual host, you can check those files to see if it's picking up your requests, and what it's doing with them if it is.
Most issues after that point will at least yield a visible error in your browser (or a blank page).
I hope this helps!
Also checking the magento error logs could tell you what the issue is, assuming it's actually hitting magento at all at this point.
As Sean mentioned above, one of the most common problems I've seen when copying a magento site is accidentally omitting the .htaccess file - make sure it's present in your site root.
If you tested your site before making the change to core_config_data, then you can also try deleting everything in var/cache and var/session. Also make sure that the web user has write permissions on var.
Regards
Hans

.htcaccess blocking cron request?

I set up my IX Webhosting to conduct the following cronjob every 15 minutes.
usr/bin/wget -O- http://xxx.com/php/xxx.php
I want the php folder to be blocked off from all outside requests for security reasons, so I set the .htaccess file to deny from all. But when the .htaccess file is present the cron job is denied with a 403 error.
I thought that server-side cronjobs are not blocked by .htaccess? Is there any way to get around this?
This is still a web request from localhost, since wget is a regular HTTP client requesting the page, and the web server is serving it (even though it may produce no output for humans to read). Instead of denying all, allow localhost:
Order deny,allow
Allow from 127.0.0.1
Deny from all
You can add something like:
Order deny,allow
Allow from 192.168.0.1/24
Allow from 127
Deny from all
in your .htacces to allow access from local intranet IP (192.168.0.1/24) and localhost IP i.e. 127.0.0.1
Change the cron job to:
/usr/bin/php /path/to/web/root/php/greader_forceupdate.php xxxx
/usr/bin/php may need to be adjusted if PHP is installed elsewhere.
/path/to/web/root is the path on the filesystem.
To access the parameter, use $_SERVER['argv'][1].

Categories