Skip to content

Tag: php

PHP display current server path

I need to setup a path in my php but I currently don’t know the path. I need to configure the paths to the uploads directory Should look like this below: My uploads.php file is in the root…so Is there anyway that I could get php to tell me my current path? Answer If you call getcwd it should give

Couldn’t fetch Mysqli_result

I’ve got this error Warning: mysqli_fetch_array() [function.mysqli-fetch-array]: Couldn’t fetch mysqli_result in /home/fights7/public_html/include/load_more_home_posts.php on line 12 And would like to know what I’ve done wrong with the below code? Answer Straight away, it appears that you ar…

Python SimpleHTTPServer with PHP

I used python -m SimpleHTTPServer, but the PHP files don’t execute instead they just been downloaded. I heard about WPHP in an old post. But I don’t know how to use it. How I can work with it ? Answer The reason why the Python Webserver sends your PHP files to the brower is likely because it is no…

Remote Server File Upload Via PHP

I have two servers, one with my website, the other for storage. I’m trying to have a page where someone can upload a file to the storage server, I’m hoping to use a form post to get it there. I’ve …

Create a zip file and download it

I am trying to download a 2 files by creating the zip file on local-server.the file is downloaded in zip format but when i try to extract it.it gives error: End-of-central-directory signature not found. Either this file is not a zip file, or it constitutes one disk of a multi-part archive. In the latter case …

Get date in Leap years php

I want to convert 59 to 2012-feb-29. I already know current year is 2012. I try following code. but it give 2012-mar-01. $string = ’59 2012′; $date1 = date_create_from_format(‘z Y’, $string); $…

Apache shows PHP code instead of executing it

I have recently been trying to install PHP and Apache on my computer. After many hours, they’re installed. I have modified the httpd.conf and php.ini files like everyone says. I then created a simple PHP script: But when I try to run it with http://127.0.0.1/phpinfo.php it just shows the source code ins…

domain registry api integrate in php

I want to integrate one API with one of my website which is a task given by my senior.The API is about searching domain name already present or not..please help me on this topic please give me n example which i can refer.my website is in PHP. Answer [EDIT 2] As @Poe mentions in his comment, gethostbyname is p…