Viewed   82 times

Everything was going great until I added AddHandler application/x-httpd-php5s .php to the .htaccess file in my local server's document root (which I change frequently depending on the site I'm working with). Since I did that when I visit http://localhost:8888 my browser just downloads the index.php and it's not processed at all, just the raw code. Now I removed that line from the .htaccess file but I'm still having this problem.

I've found that if I add an alternative entry to my hosts file for 127.0.0.1 the new entry behaves like 'localhost' used to. But if I add the line above to my .htaccess it knocks out that new host as well. I've tried reinstalling MAMP and clearing its caches and all the temporary files I could find. I surfed through Apache's httpd.conf file all to no avail.

So, to be clear: http://localhost:8888 is experiencing the above problem. If I add a new entry to my hosts file for 127.0.0.1, say 'goomba' and the above line is not in the root .htaccess (and has never been for that host/alias/whatever) then I can access http://goomba:8888 just fine. But if I do add that line to the .htaccess then I have to add yet another entry to my hosts file to get around it even if I remove that line from the the .htaccess file.

I'm fine with using a different 127.0.0.1 alias (host? what is that called?) but it's bugging me that this is still broken.

Just to be clear, I'm on Mac OS Leopard (but I'm not using the built in Apache setup, but MAMP).

 Answers

4

You are applying a mimetype where a handler should be (see documentation on handlers)

Try this instead:

AddType application/x-httpd-php5 .php

EDIT: As you have indicated caching modules are loaded, you could read up on caching and htcacheclean (to clear the disk cache). You can also temporarily use the CacheDisable directive. One other thing that you could also try is to rename the file that you have requested (e.g. index.php -> index.bak), request the file again in the browser (should now 404), then revert and try again.

Sunday, October 16, 2022
1

Try this:

'mysql' => array(
'driver'    => 'mysql',
'unix_socket'   => getenv('UNIX_SOCKET'),
'host'      => getenv('DB_HOST'),
...
),

In .env add

UNIX_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
Sunday, October 23, 2022
 
dan_lew
 
3

Had the same issue. Here's what I did.

  1. Open Terminal (/Applications/Utilities/terminal.app)

  2. Use your favorite text editor to create/edit ~/.bash_profile. For instance, if you're using vim, type vim ~/.bash_profile. I use TextMate, so I typed mate ~/.bash_profile.

  3. Add these lines:

    export MAMP_SQL=/Applications/MAMP/Library/bin 
    export MAMP_PHP=/Applications/MAMP/bin/php/php5.5.10/bin
    export PATH="$MAMP_SQL:$MAMP_PHP:$PATH"
    

    These lines ensure that the first versions of MySQL and PHP that are found (and therefore used) are the versions used by MAMP. NB: Make sure that php5.5.10 matches the version MAMP is using. You can check this against http://localhost:8888/MAMP/index.php?page=phpinfo&language=English by default. SAVE THE FILE (I shouldn't have to save this, but invariably someone complains that it doesn't work).

  4. Close your terminal window and reopen. This restarts the shell, which will load your .bash_profile script.

  5. Type which php. You should get something akin to /Applications/MAMP/bin/php/php5.5.10/bin/php

  6. Type which mysql. You should get something akin to /Applications/MAMP/Library/bin/mysql

If for any reason you get something different than the responses from 5 and 6, go back and check your .bash_profile; chances are you just neglected to save it properly.

Friday, November 25, 2022
2

First, as OMG Ponies stated, you cannot reference columns by their ordinal position. This is not an accident. The SQL specification is not built for dynamic schema either in DDL or DML.

Given that, I have to wonder why you have your data structured as you do. A sign of a mismatch between schema and the problem domain rears itself when you try to extract information. When queries are incredibly cumbersome to write, it is an indication that the schema does not properly model the domain for which it was designed.

However, be that as it may, given what you have told us, an alternate solution would be something like the following: (I'm assuming that field_1*field1 was meant to be field_1 * field_1 or field_1 squared or Power( field_1, 2 ) )

Select 1 As Sequence, field_1 As [Field], Sfield_1 As [SField], Sfiled_1 As [SFiled]
Union All Select 2, field_2, Sfield_2, Sfiled_2
...
Union All Select n, field_n, Sfield_n, Sfiled_n

Now your query looks like:

With Inputs As
    (
    Select 1 As Sequence, field_1 As [Field], Sfield_1 As [SField], Sfiled_1 As [SFiled]
    Union All Select 2, field_2, Sfield_2, Sfiled_2
    ....
    )
    ,  Results As
    (
    Select Case
            When Sequence = 1 Then Power( [Field], 2 ) - ( [SField] * [SFiled] ) 
            Else 1 / Power( [Field], 2 ) - ( [SField] * [SFiled] ) 
            End
            As Result
    From Inputs
    )
Select Exp( Sum( Log( Result ) ) )
From Results
Monday, November 21, 2022
 
2

Okay, I think I figured this out.

TL;DR

Once you add HtmlWebpackPlugin you should remove this line from index.html:

<script type="text/javascript" src="main.bundle.js"></script>

and only browse to http://localhost:8080/index.html.

The Tedious Details:

Once you add in HtmlWebpackPlugin, it takes your index.html file and merges in a <script> tag that points to your webpack bundle. It serves this merged html file from http://localhost:8080. It does this even if index.html already contains a reference to the bundle.

The plugin doesn't actually overwrite index.html with the merged version. So browsing to http://localhost:8080/src/index.html just shows you that file as it is on disk.

So if your src/index.html file looks like this before you add HtmlWebpackPlugin:

<body>
    <div id="app">it worked</div>
    <script type="text/javascript" src="main.bundle.js"></script>
</body>

then after you add HtmlWebpackPlugin, browsing to http://localhost:8080 gives you this merged version:

<body>
    <div id="app">it worked</div>
    <script type="text/javascript" src="main.bundle.js"></script>
    <script type="text/javascript" src="main.bundle.js"></script>
</body>

So now you will have two references to the bundle, the one you added in the file and the one HtmlWebpackPlugin added.

Browsing to http://localhost:8080/src gives you what's on disk at src/index.html:

<body>
    <div id="app">it worked</div>
    <script type="text/javascript" src="main.bundle.js"></script>
</body>

However, since he whole point of using HtmlWebpackPlugin is to let it insert the bundle reference for you, that means you should remove that <script> tag from src/index.html. That in turn means that browsing to src/index.html won't work anymore because you no longer have a reference to your bundle!

You are now reliant on letting HtmlWepbackPlugin insert the <script> tag for you, which means that you must now browser to http://localhost:8080/index.html to get the version it generated.

Webpack. Be. Crazy.

Tuesday, August 9, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :