Archive for category PHP

Install php scripts as cron in Windows






Linux has it’s very unique and beautiful feature “cron” that allows us to execute a program at a predefined schedule. For LAMP developers cron is a very common feature that we use very frequently. But many time lots of developers who recently have hosted their php code in Windows servers, face difficulty setting up their […]

, , ,

6 Comments

Build dropdown from Mysql SET or ENUM fields






We need to populate dropdown fields from Mysql SET or ENUM fields pretty often. So here is how I use to do it. Lets say ‘test’ is a table that has a field, ‘agree’ of type ‘SET’ having values ‘Yes’ and ‘No’. On the front end of my application I want to show a dropdown/select […]

,

12 Comments

Where to check if PHP mail() function is not working






Lots of time we find php mail() function is not working. In some cases, the email is not sent even the function returns true. Following are the points you may check while debugging: First check if the sendmail_path variable is set properly. You can see it from echo – ing phpinfo() in a page. The […]

,

8 Comments

Access files in password protected directory using curl






I had to get a page that is in a password protected directory. First I used php file_get_contents() which is always my first solution for accessing remote pages. But many web servers disable allow_url_fopen in php config. So curl is the ultimate solution. Curl has an option called CURLOPT_USERPWD that allows to add the user […]

, , ,

2 Comments