I am making a contact us page for a website. I have the html page defining all the input criteria such as name, email and message. This html file links to a php file to send the information that the user types into the message box.
my problem is that I cannot test if sending the message will work as I think the php file needs to to be run through a server. How can i test if the file works on my mac?
You should put your .php file in the htdocs folder of MAMP or XAMP. After that you must copy your file path in your browser. Replace everything up to and including htdocs with your localhost. For example: If my file is in Users/Documents/MAMP/htdocs/index.php it should be like localhost:8888/index.php
You can download mamp or xamp and install server on your mac. Then you can test your all php files.
Related
A script on my website uploads images to mysite.com/uploads and generates a path to the image uploaded like mysite.com/uploads/123456789.jpg.
The image should only to visible to users with a path to the file. The folder shouldn't list out its contents.
The script is built using PHP and runs on a Linux system (CentOS) managed by cPanel. I am new to Linux and I don't understand how this can be done and I need your help with it.
I beleive that's not PHP issue. If you using Apache webserver you need a .htaccess file in that folder with the following content:
Options -Indexes
And also you can try simply add empty file index.html in each directory you'd like to hide.
I am currently having problems with testing a known working file upload script while migrating a site to a new server.
I have migrated the entire site to the new server and everything works as it should apart from the original file upload script. I have not pointed the domain names to the new server as yet, accessing it through changing my hosts file on my local machine.
Before writing a simple upload test script, could there be any reason I am missing that is preventing my file uploads from working - for example, security issues?
Is it likely that the file upload directory location is pointing to the original server?
Please, put all the files in the content folder directly to the public directory of the live server.
E.g: Select all in the content folder and paste it directly on the public folder.
I tried downloading a directory folder using wget, and it seems to have worked properly. However all the PHP files are empty. I know that they should not be empty as they show a file size on the web directory.
The folder I am trying to download is here:
https://www.isuperman.tw/wp-content/plugins/automatewoo-referrals/
I used these directions to download recursively with wget.
How to download HTTP directory with all files and sub-directories as they appear on the online files/folders list?
Any ideas on why they are downloading blank/empty?
view-source:https://www.isuperman.tw/wp-content/plugins/automatewoo-referrals/automatewoo-referrals.php
nope the files are empty, doesnt matter whats the content of the files.. if you use wget to download a file, wget simulates A browser and get the parsed php content from the server...
and these seems to be empty
if you want to download the files with php, use ftp or the server must not parse these files and deliver its raw content
I installed WAMP at D:\wamp and put my files in D:\wamp\www. I can access and render PHP files correctly on the browser through "localhost/index.php", but if I access the file through "D:\wamp\www\index.php", the file doesn't render correctly. Why can't I access the file using the file directory?
The PHP executes script through browser. In this case localhost or http://127.0.0.1/. You can include files using include("D:\wamp\www\index.php") function.
I have searched everywhere but didn't got a perfect answer.
I am using WAMP to run PHP on local machine. I have an tag to accept file from local machine and have to upload this to FTP server.
My code is working perfectly fine but only if file is present directly on base path i.e. /wamp/www/ but if I pick file from desktop to upload, it didn't actually pass path of file to action php file instead just pass on file name.
Is there a way to achieve this functionality?
Thanks
Saransh