Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

aakarshrestha
aakarshrestha
6,509 Points

I am getting a PHP Notice: Use of undefined constant wb - assumed 'wb'.

I am getting a PHP Notice: Use of undefined constant wb - assumed 'wb'. I am using wb as a mode in fopen("filepath/imagename.jpg", "wb");

As a result i am getting a 502 Bad Gateway response from the server.

Does anyone know why i am getting a PHP Notice here and how to resolve it?

1 Answer

Vicente Armenta
Vicente Armenta
11,037 Points

Hi,

According to PHP docs, the second parameter is the mode for fopen() function, on the docs there nothing related to 'b'. Remove the 'b' from 'wb' and try again.

http://php.net/manual/en/function.fopen.php