Skip to content

Symfony 5.2 and Apache 2.4

Certainly the most convenient way to develop a Symfony 5.x app is to use the symfony server. Eventually however, you may have to deploy the application. For a number of years nginx with php-fpm was the preference for many sysadmins seeking to wring the maximum performance out of a webserver that also has to run php scripts, but there are now simple ways of configuring apache to use php-fpm while achieving comparable performance to nginx.

For example a vhost setting like this one is possible:


<VirtualHost *:80>
    SetEnv ENVIRONMENT "dev"
    <FilesMatch \.php$>
        SetHandler proxy:fcgi://php:9000
        # for Unix sockets, Apache 2.4.10 or higher
    </FilesMatch>
    # Proxy .php requests to port 9000 of the php-fpm container
    DocumentRoot /usr/local/apache2/cms/public
    ServerName cms.mydev.local
    ServerAdmin admin@mydev.local

    <Directory /usr/local/apache2/cms/public>
        DirectoryIndex index.php index.html
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
   
    # Send apache logs to stdout and stderr
    CustomLog /proc/self/fd/1 common
    ErrorLog /proc/self/fd/2
</VirtualHost>
 


Continue reading "Symfony 5.2 and Apache 2.4"

Composer install of Private Bitbucket VCS "aka" 'Invalid OAuth consumer provided'

So you have a private Bitbucket Repo and you want to utilize it in your project composer.json. You may find that when you run the composer install you get an error pulling your private Bitbucket repo with messages about Oauth failure that may include "Invalid OAuth consumer provided"

Continue reading "Composer install of Private Bitbucket VCS "aka" 'Invalid OAuth consumer provided'"

3 Part PHP Development Tutorial at phpfreaks.com

It took me a few years to write, but I finally completed and published my 3 Part introduction to web development on phpFreaks.com. Eric of phpFreaks wrote a new publishing engine, which includes a print feature, and my recollection is that if you use that to print out the series, it ends up being 60 pages or so printed out on 8.5x11. I've received numerous emails from readers over the couple of years between Part I and Parts 2 & 3, asking when Part 2 was coming. At a certain point, I'm sure it looked as though this might be the Remo Williams of the PHP tutorial world. When I wrote Part I, I promised a sequel, but after a year had passed, I doubt anyone would have been willing to bet on Part 2, or even for that matter, would still care to read it.

While I'm not in a position to answer any questions about the importance of the series, I felt I bore a responsibility wholly of my own making, to deliver on the implicit promise of an article I had the hubris to entitle Part I. I'd written a portion of Part II wll over a year ago, where it sat on my hard drive, even as the emails continuted to dribble in, always with the question of "when or where was Part 2?" I finally sat down and finished it during a recent visit by Tracy's mom, Betty, who graciously occupied Niamh and allowed me several days of uninterrupted time at my desk. Because this was a programming article, it entailed writing and testing the code to be included, and generating the screen shots as illustration. In summary, it turned out to be a lot more time an effort than I had bargained for.

What really drove me to expend the effort, was the opportunity to dedicate the series to my Dad, Frank Rolston III who passed away unexpectedly, earlier this year. Dad was an advocate of "finish what you start." Continue reading "3 Part PHP Development Tutorial at phpfreaks.com"

Referer spammers: New scourge of the web

When someone creates a link to a webpage you have, and someone clicks on that link, the standard browsers include code that carries over information that tells you what server "referred" you. This information shows up in your standard webserver log, and can also be grabbed by cgi and serverside scripts. For example in PHP that information can be gotten using the $_SERVER superglobal array:


echo $_SERVER['HTTP_REFERER'];
 


As an aside, yes they did spell that REFERER, and I assume that the history of that misspelling goes back to the folks who created the CGI-BIN API.

The referrer comes in as part of the http header sent by the browser with its request, and it has always been possible to suppress or change the referer information, so most folks consider "referer" information as a useful indication of sites that have linked to you, but nothing you can depend on.

Lately, there seem to be more and more unscrupolous people marketing software to others which does nothing but waste bandwidth hitting long lists of sites and generating referrer entries in your web logs. Their reasoning is that you will check your logs (and every website reporting package includes information about the refers you get) and very possibly click on them to see how you're being linked, or what their site is about. Continue reading "Referer spammers: New scourge of the web"

Exploring Mysql CURDATE and NOW. The same but different.

Sometimes I see people attempting to use VARCHARS or CHARS to store dates in their MySQL database application. This is really fighting against MySQL, which has a variety of interchangeable date types. Internally MySQL is storing dates as numbers, which allows it to do all sorts of nice arithmetic and comparisons with very little effort on your part. For example, when you use a mysql DATE column to store a date, you don't have to worry about sortation, or comparing that date to another DATE, because MySQL already understands how to do those things internally. A lot of people also don't realize that they can output a DATE column in just about any way they choose using the DATE_FORMAT function. This causes people to shy away from using DATE, DATETIME, TIME, or TIMESTAMP columns, when they really should.

Continue reading "Exploring Mysql CURDATE and NOW. The same but different."